1

我在我的 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.jsapp\env.js文件会添加到清单文件中,这HarmonyModules : true意味着什么。

任何帮助表示赞赏。谢谢 :)

4

0 回答 0