Webpack优化动态主题加载

This commit is contained in:
tangly1024
2023-06-20 14:20:43 +08:00
parent 16bdf3a745
commit c92fbafc39
29 changed files with 127 additions and 391 deletions

View File

@@ -2,6 +2,9 @@ const withBundleAnalyzer = require('@next/bundle-analyzer')({
enabled: process.env.ANALYZE === 'true'
})
const { THEME } = require('./blog.config')
const path = require('path')
module.exports = withBundleAnalyzer({
images: {
// 图片压缩
@@ -64,6 +67,10 @@ module.exports = withBundleAnalyzer({
// 'react-dom': 'preact/compat'
// })
// }
// 动态主题:添加 resolve.alias 配置,将动态路径映射到实际路径
config.resolve.alias['@theme-components'] = path.resolve(__dirname, 'themes', THEME)
return config
}
})