mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-11-21 01:13:16 +08:00
21 lines
471 B
JavaScript
21 lines
471 B
JavaScript
function transformIndexHtml(code) {
|
|
switch (require('node:process').env.NODE_ENV) {
|
|
case 'production':
|
|
return code.replace(/__INDEX__/, 'demo/index.prod.js')
|
|
default:
|
|
return code.replace(/__INDEX__/, 'demo/index.dev.js')
|
|
}
|
|
}
|
|
|
|
const demoIndexTransFormPlugin = {
|
|
name: 'demo-transform',
|
|
transformIndexHtml: {
|
|
order: 'pre',
|
|
handler: (code) => {
|
|
return transformIndexHtml(code)
|
|
}
|
|
}
|
|
}
|
|
|
|
module.exports = demoIndexTransFormPlugin
|