Skip to content
This repository has been archived by the owner on Jan 21, 2021. It is now read-only.

Multiple html plugins #48

Closed
furstenheim opened this issue Dec 19, 2017 · 5 comments
Closed

Multiple html plugins #48

furstenheim opened this issue Dec 19, 2017 · 5 comments
Labels

Comments

@furstenheim
Copy link

Hi,
I have the following use case. In a webpack config I'm creating several html files as in this question. I can't find any way in the documentation to treat that case with preload webpack plugin. That is:

plugins: [
  new HtmlWebpackPlugin({
    filename: 'index.html',
    template: 'src/index.html',
    chunks: ['main']
  }),
  new HtmlWebpackPlugin({
    filename: 'example.html',
    template: 'src/example.html',
    chunks: ['exampleEntry']
  }),
  // I want this to affect only index.html
  new PreloadWebpackPlugin()     
]

Is it possible to do it with this plugin? In the README there are only examples on how to filter the chunks, but not the destination.

Thanks

@jeffposnick
Copy link
Contributor

Are you using the new 2.1.1 release? It includes changes that affect the multiple HtmlWebpackPlugin use case: https://github.com/GoogleChromeLabs/preload-webpack-plugin/pull/37/files

Before debugging further, I wanted to clarify that.

@furstenheim
Copy link
Author

I wasn't aware it existed. In any case in the pr that you mention there isn't yet any example with multiple files, right? For example, in demo webpack config there are indeed two html plugins but there is no configuration in the preload plugin of what html it should affect.

new webpack.LoaderOptionsPlugin({
  minimize: true,
  debug: false
})

@toxic-johann
Copy link
Contributor

@jeffposnick Hmmm. Actually we have not provide an option to choose which entry should be handled. But we have fileBlackList, which can do this job, but seems weird.

Maybe we can introduce a new option. I think I can do this.

@huanggm
Copy link

huanggm commented Feb 6, 2018

@toxic-johann Is this question solved?

toxic-johann added a commit to toxic-johann/preload-webpack-plugin that referenced this issue Feb 7, 2018
jeffposnick added a commit that referenced this issue Feb 11, 2018
Add excludeHtmlNames to solve problem mentioned in #48
@jeffposnick
Copy link
Contributor

I've merged #54, which should fix this in a backwards-compatible fashion. Thanks, @toxic-johann!

I think we could benefit from rethinking what the ideal interface would be in an upcoming major version release, where there is some flexibility in breaking the existing interface. I'll open an issue in the near-future with a proposal (once I've had some time to think about it as well), and I'd love input there.

CC: @addyosmani

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

No branches or pull requests

4 participants