Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with 'autodll-webpack-plugin' #75

Open
huixisheng opened this issue Mar 1, 2019 · 2 comments
Open

Incompatibility with 'autodll-webpack-plugin' #75

huixisheng opened this issue Mar 1, 2019 · 2 comments

Comments

@huixisheng
Copy link

image

webpack.config.js

    plugins.push(new AutoDllPlugin({
      inject: true,
      filename: '[name]_[hash:8].js',
      debug: true,
      path: './dll',
      entry: {
        vendor: [
          'vue-router',
          'vuex',
          'nprogress',
        ],
      },
    }));
@vzaidman
Copy link

vzaidman commented Apr 14, 2019

I would like to fix it. Does anybody can provide me with any help with it?

@dalaoque
Copy link

Webpack config plugins list order with speed-measure-webpack-plugin

It used concat()

The source code is as follows

config.plugins = config.plugins.concat(this);

SpeedMeasurePlugin was after DllReferencePlugin or AutoDllPlugin and at the bottom on the plugins list.

const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");

const smp = new SpeedMeasurePlugin();

const webpackConfig = smp.wrap({
  plugins: [
    new MyPlugin(),
    new MyOtherPlugin()
  ]
});

console.log('webpackConfig: ', webpackConfig)

webpackConfig:

{
  ...,
  plugins: [
    DefinePlugin { definitions: [Object] },
    HtmlWebpackPlugin {
      options: [Object],
      childCompilerHash: undefined,
      assetJson: undefined,
      hash: undefined,
      version: 4
    },
    MiniCssExtractPlugin { options: [Object] },
    CopyPlugin { patterns: [Array], options: {} },
    DllReferencePlugin { options: [Object] },
    AddAssetHtmlPlugin { assets: [Array], addedAssets: [] },
    SpeedMeasurePlugin {
      options: {},
      timeEventData: {},
      smpPluginAdded: true,
      wrap: [Function: bound wrap],
      getOutput: [Function: bound getOutput],
      addTimeEvent: [Function: bound addTimeEvent],
      apply: [Function: bound apply],
      provideLoaderTiming: [Function: bound provideLoaderTiming]
    }
  ]
  }
}

So, Put the SpeedMeasurePlugin in front of the DllReferencePlugin or AutoDllPlugin.

  1. Not used wrap
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");

const webpackConfig = {
  plugins: [
    new SpeedMeasurePlugin(),

    new MyPlugin(),
    new MyOtherPlugin(),
    ...
  ]
})
  1. Change sequence
const SpeedMeasurePlugin = require("speed-measure-webpack-plugin");

const smp = new SpeedMeasurePlugin();

const smpWrapConfig = smp.wrap({
  plugins: []
});
const webpackConfig = {
  entry: {
    app: './src/index.js',
  },
  output: {},
  plugins: [
    new MyPlugin(),
    new MyOtherPlugin()
  ]
}
webpackConfig.unshift(...smpWrapConfig.plugins)

module.exports = webpackConfig
  1. It's up to the author. ^_^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants