问题是这样的,我们是用electron-vue 工程,打包使用webpack 。近期发现node_modules 越来越大,我把exe解压后发现是因为node_modules 大,后面发现是因为node_module 里面有一堆source map 文件和demo等冗余文件在里面,
问题 :如何通过webpack 配置排除掉node_modules 里面的某些文件,以减小打包后的exe体积
module.exports = {
productionSourceMap: false,
}
打包后不需要sourcemap,直接在wenbpack里面配置打包相关配置
build: {
outDir: "dist",
sourcemap: false, //是否生成source map文件。默认值为false
terserOptions: {
compress: {
drop_console: false, //生产环境移除console
drop_debugger: false, //生产环境移除debugger
},
},
},