-
Notifications
You must be signed in to change notification settings - Fork 47
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
Can not use with external scripts in webpack 5 #167
Comments
Interesting. What do you expect to happen instead? I'm asking because without supplying the integrity hash in some way via config, you're probably better off disabling this plugin anyway. That said at the very least we should be printing a better error message in this case. |
If you do want to use SRI, the best workaround is probably to use an explicit |
At least report the error as a warning without interrupting the build process.
|
@jscheid the same issue happens for the following scenario, where I inject an external script: new HtmlWebpackTagsPlugin({
append: false,
usePublicPath: false,
scripts: [
{
path: `https://www.googletagmanager.com/gtag/js?id=ID`,
attributes: { async: true, integrity: false },
},
],
}), Where it outputs ERROR in Error: ENOENT: no such file or directory, open '/Users/<username>/<application-name>/https:/www.googletagmanager.com/gtag/js?id=foo'
- plugin.js:199 Plugin.processTag
[<application-name>]/[webpack-subresource-integrity]/plugin.js:199:78
- plugin.js:229
[<application-name>]/[webpack-subresource-integrity]/plugin.js:229:40
- Array.forEach
- plugin.js:229 Plugin.handleHwpBodyTags
[<application-name>]/[webpack-subresource-integrity]/plugin.js:229:18
- index.js:94
[<application-name>]/[webpack-subresource-integrity]/index.js:94:28
- index.js:572 onAlterAssetTagGroups
[<application-name>]/[html-webpack-tags-plugin]/index.js:572:9 |
I was getting this message
this will inject the scripts without the integrity attribute.
|
@themgoncalves I had the same problem. Did you solve it? |
"webpack": "5.51.1"
"webpack-subresource-integrity": "5.0.0"
Webpack config
Error
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'undefined')
https://disk.yandex.ru/d/jkJgW-Q0zLSg4Q
The text was updated successfully, but these errors were encountered: