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

WP4, Multiple Entry Points script injected in all files. #880

Closed
ghost opened this issue Mar 4, 2018 · 8 comments
Closed

WP4, Multiple Entry Points script injected in all files. #880

ghost opened this issue Mar 4, 2018 · 8 comments

Comments

@ghost
Copy link

ghost commented Mar 4, 2018

I am trying to separate entry points. This was ok with webpack 3.
I have 2 entry and expecting 2 different output.
Basically expecting login script injected to login page, index script injected to index page. No success yet.
screen shot 2018-03-04 at 05 53 23

This is the login html file. Network tab.
screen shot 2018-03-04 at 05 54 44

This is the index html file. Network tab.
screen shot 2018-03-04 at 05 55 19

I tried both repos. Same result.
webpack-contrib/html-webpack-plugin
jantimon/html-webpack-plugin

And webpack config for chunks. Tried thousand different setting here.
screen shot 2018-03-04 at 06 01 43

This is the html-webpack-plugin setup. Tried thousand different setting here, too.
screen shot 2018-03-04 at 06 03 08

@ghost
Copy link
Author

ghost commented Mar 4, 2018

I finally made it work like this. Now all files injected in correct place.

splitChunks: {
 cacheGroups: {
   index: {
     name: "index",
     chunks: "async",
},
   login: {
     name: "login",
      chunks: "async",
},
}

@jiangfengming
Copy link

In order to make splitting initial chunks and generating runtime chunk possible, I wrote this plugin: https://github.com/fenivana/html-webpack-include-sibling-chunks-plugin

@fvigotti
Copy link

fvigotti commented Apr 10, 2018

I'm new to webpack , and I'm also trying to setup multiple entry-point , and webpack4 is the first version of webpack I've used.. so I thought that this plugin was not working for multiple-entry point, but now if you say
that in version 3 it worked, so probably It's a bug..
the problem is that OR I specify specific chunks and the application will include only those chunks but then I have to explicit the full dependency graph ( entrypoint + commonchunks that this entrypoint partecipated in ) , or if I specify none it will include all entrypoints and chunks in all instances of htmlwebpackplugin

so definitely both solutions are impossible to use...
(I think that this should be pointed as major bug for this plugin or at least specify in main readme that cannot be used with multiple entrypoint )

(@fenivana ) your plugin as patch to html-webpack-plugin works perfectly in my usecase :) thank you, anyway I still want to suggest to apply somehow the functionality of his plugin in html-webpack-plugin to avoid the necessity of having a plugin to patch another one.. :)

Repository owner deleted a comment Apr 10, 2018
@jantimon
Copy link
Owner

This issue involves a lot of refactoring as we need to switch to the webpack 4 api.
An entire refactoring will break this plugin for millions of people so we want wo be sure that the change is done well.
It will probably take about 5 days of work to get it done.
I am really thankful for your feedback but right now I am not able to get it fixed as fast as I wish I could.
Hopefully I’ll get the opportunity to invest those five days soon. If you want to support this issue I am happy to help you get into the code or if you don’t want to invest your time but think it’s worth 5$ feel free to support the project on open collective..

@jantimon
Copy link
Owner

jantimon commented Jun 4, 2018

Could you please try if this works for you with 4.x alpha?
Pull Request: #958

Npm pre release:

npm i html-webpack-plugin@next

@ghost
Copy link
Author

ghost commented Jun 27, 2018

@jantimon It is ok. Thanks.

@ghost ghost closed this as completed Jun 27, 2018
@jakelauer
Copy link

@jantimon How is this meant to be used? I'm running into the same problem, and after installing the @next version of html-webpack-plugin, I'm trying to configure webpack.config.js to work this way but I'm having trouble.

@lock
Copy link

lock bot commented Aug 3, 2018

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Aug 3, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants