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

A second build is triggered since alpha 17 #1581

Closed
zlk89 opened this issue Jan 5, 2021 · 8 comments
Closed

A second build is triggered since alpha 17 #1581

zlk89 opened this issue Jan 5, 2021 · 8 comments

Comments

@zlk89
Copy link

zlk89 commented Jan 5, 2021

Current behaviour 💣

Seeing webpack got triggered a second build, since html-webpack-plugin removes a local file after initial build:

FILES REMOVED:
  data:text/javascript,__webpack_public_path__ = htmlWebpackPluginPublicPath;

It was working fine on alpha 16 version.

Expected behaviour ☀️

No file removed after initial build

Reproduction Example 👾

https://codesandbox.io/s/html-webpack-plugin-5x-alpha-forked-57fug?file=/webpack.config.js

You will see it triggers a second build right after initial one under development mode.
(There is a bug in codesandbox, you might need to open a new terminal and run yarn start to see the webpack compilation log)

Environment 🖥

Node.js v12.16.1
darwin 19.6.0
npm version: 6.13.4
webpack: 5.11.1
html-webpack-plugin: 5.0.0-alpha.17

@jantimon
Copy link
Owner

jantimon commented Jan 5, 2021

Hey @zlk89

thank you so much for your bug report - this bug is already known..

The reason is that it is using a new webpack 5 feature which is not working correctly with watchpack.
The webpack core team is trying to fix it:

webpack/webpack#12283

@joealden
Copy link

FYI, webpack/webpack#12283 was resolved in [email protected]. @zlk89 could you please verify if the problem you were experiencing has been resolved?

@zlk89
Copy link
Author

zlk89 commented Jan 11, 2021

tried 5.12.3, looks like it works now!

@zlk89 zlk89 closed this as completed Jan 11, 2021
@artembatura
Copy link
Contributor

Issue still reproducible with Yarn 2. With NPM works fine.

{
  "html-webpack-plugin": "5.0.0-beta.6",
  "webpack": "5.16.0",
}

@jantimon
Copy link
Owner

maybe yarn installs old versions?

can you please try if the reproduction example without html-webpack-plugin from from webpack/webpack#12283 fails also for yarn 2?

@artembatura
Copy link
Contributor

artembatura commented Jan 23, 2021

@jantimon I can't reproduce problem with your example and Yarn 2. But I can still reproduce it by using simple config:

module.exports = {
  ...
  plugins: [
    new HtmlWebpackPlugin(),
  ]
};

So commenting line with html-webpack-plugin does fix the issue.

After investigation I think this problem is not related to html-webpack-plugin directly, because I can reproduce it even with file-loader, css and Babel stuff. I will create issue in webpack repo

@artembatura
Copy link
Contributor

Created issue in webpack repository: webpack/webpack#12483

@jantimon
Copy link
Owner

thank you :)

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

4 participants