mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
18 lines
407 B
JavaScript
18 lines
407 B
JavaScript
const cleanCssr = require('./utils/clean-cssr')
|
|
|
|
module.exports = () => {
|
|
return {
|
|
configureServer: [
|
|
async ({ app }) => {
|
|
app.use(async (ctx, next) => {
|
|
await next()
|
|
// if not ctx.body, it should be a http 304
|
|
if (ctx.path.endsWith('.cssr.js') && ctx.body) {
|
|
ctx.body = cleanCssr(ctx.body.toString())
|
|
}
|
|
})
|
|
}
|
|
]
|
|
}
|
|
}
|