webpack - 为什么lodash会在webpack中自动拆分成vendor?
问题描述
我正在使用带有反应的 webpack。在一个屏幕中导入 lodash 时,我很困惑地看到有一个供应商捆绑文件/js/vendors-node_modules_lodash_lodash_js.3715c9aa.js。我没有配置SplitChunksPlugin选项。
我的 webpack 配置文件
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
mode: "development",
entry: './src/index.js',
output: {
filename: 'js/[name].[contenthash:8].js',
path: path.resolve(__dirname, 'dist'),
clean: true
},
module: {
rules: [
{
test: /\.js$/i,
use: ["babel-loader"],
exclude: /node_modules/
},
]
},
plugins: [
new HtmlWebpackPlugin({
template: "index.html"
})
],
devServer: {
contentBase: path.join(__dirname, 'dist'),
compress: true,
port: 9000,
host: "localhost",
open: true,
historyApiFallback: true,
}
};
解决方案
推荐阅读
- google-chrome - 如何使用 Chrome Devtool 协议获取请求标头
- woocommerce - 在“您的订单”下的 WooCommerce 结帐页面中重命名“输入您的地址以查看运输选项”
- asp.net - ApiController HttpPost 参数
- jmeter - 如何将提取的 One Request 值传输到 CSV 并再次在 Jmeter 中重用 CSV 数据?
- java - 如何仅从数组中输出以“b”开头的单词
- ruby-on-rails - Rails 多态性相对于多个外键有什么好处?
- r - 将数据集从宽格式重塑为长格式,按变量后缀分组
- ios - swift中UIWebView(已弃用)和webkit View之间的区别
- c++ - 自旋锁能保证获取顺序吗?
- android - 如何在片段中使用水平滚动视图?