mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-02-05 13:00:47 +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())
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|