fix function getScriptName in element.js
koalaink opened this issue · 2 comments
koalaink commented
webpack config
{
...
plugins:[
new webpack.optimize.CommonsChunkPlugin({
name: [`${project.projectName}/js/vendor`, `${project.projectName}/js/manifest`],
minChunks: Infinity,
filename: `[name].[chunkhash:8].js`,
}),
new ScriptExtHtmlWebpackPlugin({
inline: 'manifest'
}),
]
Error: ScriptExtHtmlWebpackPlugin: no asset with href 'manifest.d41d8cd9.js'
modify function getScriptName as bellow, it works well
const getScriptName = (options, tag, compilation) => {
let scriptName = getRawScriptName(tag);
// remove publicPath prefix
// if (scriptName.includes('/')) {
// scriptName = scriptName.replace(CONSTANTS.PUBLIC_PATH_PREFIX, '');
// }
scriptName = scriptName.replace(compilation.outputOptions.publicPath, '');
if (options.htmlWebpackOptions.hash) {
scriptName = scriptName.split('?', 1)[0];
}
return scriptName;
};
numical commented
Hi,
I could not repeat your issue - I suspected either the chunkhash or the mutliple '/'s in the path, but neither seemed to break ScriptExt.
However your suggested change was a good one so I included it in a refactor for v1.7.4. Could you try out v1.7.4 to see if it fixes your issue. I will assume so as it is your suggesed fix (!) but do let me know if not.
koalaink commented
My issue is fixed with v1.8.0. thx