Webpack 从条目中排除文件的网页包
我在webpack.config中有三个入口点:Webpack 从条目中排除文件的网页包,webpack,webpack-2,Webpack,Webpack 2,我在webpack.config中有三个入口点: entry: { entry1: './app', entry2: './app/sub1', entry3: './app', } 我需要从entry3中排除位于./app/excluded/excluded_file.js中的单个文件: 类似的内容在webpack中不起作用: entry: { entry1: './app', entry2: './app/sub1', entry3: ['./app',
entry: {
entry1: './app',
entry2: './app/sub1',
entry3: './app',
}
我需要从entry3中排除位于./app/excluded/excluded_file.js中的单个文件:
类似的内容在webpack中不起作用:
entry: {
entry1: './app',
entry2: './app/sub1',
entry3: ['./app', '!./app/excluded/excluded_file.js'],
}
或者使用网页包插件?如果使用模拟文件是一个可行的选项,您可以使用以下方法用模拟的模块路径覆盖不需要的模块路径:
你好,阿萨迪。提取单个文件是什么意思?只是移动文件?@toomuchdesign我的意思是排除单个文件…@toomuchdesign我不想更改代码库中的任何文件,只是使用webpack配置?
// 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')
]
}