naive-ui/build/vite-plugin-index-tranform.js

21 lines
471 B
JavaScript
Raw Normal View History

function transformIndexHtml(code) {
switch (require('node:process').env.NODE_ENV) {
case 'production':
2023-12-03 19:51:47 +08:00
return code.replace(/__INDEX__/, 'demo/index.prod.js')
default:
2023-12-03 19:51:47 +08:00
return code.replace(/__INDEX__/, 'demo/index.dev.js')
}
}
2021-02-17 23:31:56 +08:00
const demoIndexTransFormPlugin = {
name: 'demo-transform',
2023-12-03 19:51:47 +08:00
transformIndexHtml: {
order: 'pre',
handler: (code) => {
return transformIndexHtml(code)
}
2023-12-03 19:51:47 +08:00
}
}
module.exports = demoIndexTransFormPlugin