Webpack DllPlugin-意外行为

时间:2018-07-13 09:29:46

标签: javascript reactjs webpack react-boilerplate 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 文件,以及{{1} }表示。

感谢您的帮助。谢谢:)

0 个答案:

没有答案