Open sknightq opened 5 years ago
What's more, everything will be OK if I use my old node_modules. But I found the versions of html-webpack-externals-plugin in two node_modules are same (v3.8.0) The old node_modules is created under node-v8.11.0 The new one is created under node-v8.16.0
I used html-webpack-tags-plugin that is depended by html-webpack-externals-plugin to resolve my problem. This plugin should be upgraded.
new HtmlWebpackTagsPlugin({
append: false,
publicPath: false,
tags: [
baseConfig.build.corsDomain +
':' +
baseConfig.build.corsMainPort +
baseConfig.build.externalJs
]
})
I have the same problem.
I have the same problem.
@Trendymen You can use html-webpack-tags-html to replace of html-webpack-externals-plugin. This is example.
I have the same problem.
@Trendymen You can use html-webpack-tags-html to replace of html-webpack-externals-plugin. This is example.
There is still one way to continue to use this plugin, if you want.(I try many times to make it before I see this issue, too sad.)
Create one option array of this plugins in the file which you create multiple entries, each of option specify the html you want to inject.
// util.js
htmlWebpackExternalsPlugins.push(
new htmlWebpackExternalsPlugin({
externals: externalsConfig,
hash: true,
files: [`${pageName}.html`],
})
);
export htmlWebpackExternalsPlugins;
// webpack.prod.js
const { htmlWebpackExternalsPlugins } = require('./utils.js')
module.exports = {
plugins: [
....htmlWebpackExternalsPlugins
]
}
I have many entries and each entry need to inject an external javascript called aepmod.js (just like a CDN jquery), but I got wrong times of injection in my dist folder.
The first file gets one inject. The second one gets two, The third one gets three ..... The last one gets many times (The times depend on the order of my file)! Following is my webpack production config: And the path in 'externals' config represents the URL of aepmod.js