我在webpack.config中有三个入口点:
entry: {
entry1: './app',
entry2: './app/sub1',
entry3: './app',
}
我需要从./app/excluded/excluded_file.js
中排除单个文件(位于entry3
):
之类的东西(在webpack中不起作用):
entry: {
entry1: './app',
entry2: './app/sub1',
entry3: ['./app', '!./app/excluded/excluded_file.js'],
}
或使用Webpack插件?
答案 0 :(得分:1)
如果使用模拟文件是一个可行的选项,您可以使用path-override-webpack-plugin 覆盖不受欢迎的模块路径:
// webpack.config.js
import PathOverridePlugin from 'path-override-webpack-plugin';
const webpackConfig = {
plugins: [
// Adjust the paths to the structure of your project
new PathOverridePlugin(/^app\/excluded/, './mock-folder')
]
}