mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-27 05:00:48 +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())
|
|
}
|
|
})
|
|
}
|
|
]
|
|
}
|
|
}
|