jharris4 / html-webpack-tags-plugin

lets you define html tags to inject with html-webpack-plugin
MIT License
255 stars 31 forks source link

External from included assets #10

Closed justincorrigible closed 7 years ago

justincorrigible commented 7 years ago

Beforehand, I am somewhat ignorant in this regard, but is it possible to add one of the included assets as an external? Say if you load jQuery through this plugin, could I refer to it in the same webpack config as an external, to expose it as a global variable, or even use it in my app?

Not sure if what I'm asking even makes sense technically.

jharris4 commented 7 years ago

Are you referring to using the webpack.ProvidePlugin ?

If so then webpack actually automatically includes the package that you're providing into the generated bundles. This means there's no need to separately include the provided asset...

jharris4 commented 7 years ago

Or, if you mean using the externals section of the webpack config, then yes, you can set an external, and then also include the script for that external asset via html-webpack-include-assets-plugin

mmiller42 commented 7 years ago

@hallaathrad Also, if you're interested, I built a separate plugin that uses html-webpack-include-assets-plugin to do this behind the scenes: html-webpack-externals-plugin.

justincorrigible commented 7 years ago

@mmiller42 I've managed to get it working with the plugin @jharris4 suggested; yet I'm willing to give yours a try if only to reduce boilerplate. Lemme get back to you later, when I get back to this. :+1: