Code Monkey home page Code Monkey logo

Comments (6)

scinos avatar scinos commented on June 12, 2024

I'll take a look ASAP

from webpack-plugin-hash-output.

sunkeysun avatar sunkeysun commented on June 12, 2024

I also encounter this issue on version 3.1.1, but version 3.1.0 not has this problem.

from webpack-plugin-hash-output.

scinos avatar scinos commented on June 12, 2024

@wulucxy, @sunkeysun could you try with

plugins: [
  new WebpackPluginHashOutput(),
  new HtmlWebpackPlugin({
      filename: 'index.html',
      template: 'public/index.html',
      chunks: ['manifest', 'vendor', 'app']
    })
]

(i.e. webpack-plugin-hash-output before html-webpack-plugin)?

According to my test this should fix the problem. If that's the case, I'll update the README and, if possible, try to detect the wrong order and print a warning.

from webpack-plugin-hash-output.

wulucxy avatar wulucxy commented on June 12, 2024

@scinos this is OK。but how is this happen?

from webpack-plugin-hash-output.

scinos avatar scinos commented on June 12, 2024

TLDR: we changed the webpack phase where the plugin runs and now it competes with html-webpack-plugin

So in v 3.1.1 and 1.3.1 we changed the webpack hook used to run the plugin from after-optimize-chunk-assets to emit. The reason for using after-optimize-chunk-assets in the past was mainly because I didn't know better (😩), I should have used emit form the beginning because it makes more sense. This was also causing bugs with other plugins (#22).

So now it runs in emit. But there are other plugins that also run on emit, like html-webpack-plugin). I do have a test for html-webpack-plugin, and because it run fine, I didn't consider this could break anything, my bad.

For the plugin to work it has to be the first plugin in the emit phase (which is determined by the order of the plugins in your webpack.config.js.

from webpack-plugin-hash-output.

scinos avatar scinos commented on June 12, 2024

I released a new version (3.2.0) that will print a warning if there are other plugins that might interfere with us:

[WARNING] There are other plugins configured that might interfere with
webpack-plugin-hash-output. For this plugin to work correctly, it should
be the first plugin in the "emit" phase. Please be sure that the rest of the
plugins run after webpack-plugin-hash-output (ensure they are listed after
webpack-plugin-hash-output in the 'plugins' option in your webpack config).

Plugins that could interfere with webpack-plugin-hash-output:
 * HtmlWebpackPlugin

from webpack-plugin-hash-output.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.