javascript - Webpack DllPlugin - 意外行为
问题描述
我在我的 react 项目中使用 webpack dllplugin 进行开发配置。我发现我的两个文件没有更新更改。我发现这是因为它们被添加到了 dll 清单中。下面是我的 dll webpack 配置文件和运行以下命令后创建的清单:
cross-env BUILDING_DLL=true webpack --display-chunks --color --config internals/webpack/webpack.dll.babel.js --hide-modules
.
webpack.dll.babel.js:
const path = resolve('../node_modules/react-boilerplate-dlls');
const outputPath = path.join(process.cwd(), path);
var entry = { reactBoilerplateDeps:
[ 'babel-polyfill',
'fontfaceobserver',
'history',
'hoist-non-react-statics',
'immutable',
'intl',
'invariant',
'lodash',
'prop-types',
'query-string',
'react',
'react-dom',
'react-helmet',
'react-intl',
'react-loadable',
'react-redux',
'react-router-dom',
'react-router-redux',
'redux',
'redux-immutable',
'redux-saga',
'reselect',
'styled-components',
'warning',
'whatwg-fetch',
'core-js',
'eventsource-polyfill' ] }
module.exports = require('./webpack.base.babel')({
context: process.cwd(),
entry: entry,
devtool: 'eval',
output: {
filename: '[name].dll.js',
path: outputPath,
library: '[name]',
},
plugins: [
new webpack.DllPlugin({
name: '[name]',
path: join(outputPath, '[name].json'),
}),
],
performance: {
hints: false,
},
});
reactBoilerplateDeps.json:
{
"name": "reactBoilerplateDeps",
"content": {
.....,
"./app/utils/request.js": {
"id": "./app/utils/request.js",
"meta": {
"harmonyModule": true
},
"exports": [
"default"
]
},
"./node_modules/exports-loader/index.js?self.fetch!./node_modules/whatwg-fetch/fetch.js": {
"id": "./node_modules/exports-loader/index.js?self.fetch!./node_modules/whatwg-fetch/fetch.js",
"meta": {
}
},
"./app/env.js": {
"id": "./app/env.js",
"meta": {
"harmonyModule": true
},
"exports": [
"default"
]
},
"./node_modules/core-js/shim.js": {
"id": "./node_modules/core-js/shim.js",
"meta": {
}
},
.....
}
}
我不明白为什么app\utils\request.js和app\env.js文件会添加到清单文件中,这HarmonyModules : true
意味着什么。
任何帮助表示赞赏。谢谢 :)
解决方案
推荐阅读
- python - Python中的障碍期权定价
- reporting-services - SSRS 2019 不会在 https url 上以 html5 格式呈现图像
- java - 从 Android 的 json 文件中获取不同的照片
- reactjs - web3 订阅事件触发两次
- python - 如何在 Python 中广播列表?
- azure-synapse - 如何通过 Synapse 的 Spark 池将数据帧数据附加到专用的 SQL 池中?
- thymeleaf - 如何将身份验证原则值设置为变量
- javascript - 等待最后一个 ajax 请求在复杂链中解析
- mysql - 为什么我需要为 MySQL 8 禁用“foreign_key_checks”才能在添加外键时使用 INPLACE 算法?
- mysql - mysql 问题:在 Apple Silicon M1 mini 上升级到 Mac OS X 11.6 后,无法连接