结合
webpack chain
通过this.store.chainName
可以获取相关配置名,也可以手动根据下面提供名称进行配置 如:
import {defineConfig} from '@empjs/cli'
export default defineConfig(store => {
return {
chain(config) {
config.plugin('definePlugin').tap(o => {
console.log('definePlugin', o)
return o
})
},
}
})
export const chainName = {
rule: {
mjs: 'mjs',
typescript: 'typescript',
javascript: 'javascript',
sourceMap: 'sourceMapLoader',
inline: 'inline',
svg: 'svg',
image: 'image',
font: 'fonts',
svga: 'svga',
sass: 'sass',
less: 'less',
css: 'css',
},
use: {
swc: 'swc',
sourceMap: 'sourceMapLoader',
sass: 'sassLoader',
less: 'lessLoader',
},
plugin: {
bundleAnalyzer: 'bundleAnalyzerPlugin',
define: 'definePlugin',
copy: 'copyRspackPlugin',
progress: 'progressPlugin',
empShare: 'empShare',
html: {
prefix: 'html-plugin-',
empSharePrefix: 'html-plugin-empShare-',
importMapPrefix: 'html-plugin-import-map-',
hooks: {
empShareLib: 'HtmlEmpShareLibPluginName',
importMap: 'HtmlImportMapPlugin',
},
},
},
minimizer: {
minJs: 'minJs',
minCss: 'minCss',
},
}