Skip to content

Commit

Permalink
Merge 2745c3a into 914fdd9
Browse files Browse the repository at this point in the history
  • Loading branch information
IronGeek committed Aug 26, 2023
2 parents 914fdd9 + 2745c3a commit 203429b
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 1 deletion.
1 change: 1 addition & 0 deletions examples/issue-221/index.js
@@ -0,0 +1 @@
console.log("ok");
15 changes: 15 additions & 0 deletions examples/issue-221/package.json
@@ -0,0 +1,15 @@
{
"name": "issue-221",
"description": "Test case for https://github.com/waysact/webpack-subresource-integrity/issues/221",
"version": "1.0.0",
"license": "MIT",
"private": true,
"devDependencies": {
"expect": "^26.6.2",
"html-webpack-plugin": ">= 5.0.0-beta.1",
"nyc": "*",
"webpack": "^5.44.0",
"webpack-cli": "4",
"webpack-subresource-integrity": "*"
}
}
28 changes: 28 additions & 0 deletions examples/issue-221/webpack.config.js
@@ -0,0 +1,28 @@
const { SubresourceIntegrityPlugin } = require("webpack-subresource-integrity");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const expect = require("expect");

module.exports = {
entry: {
"why 1+1=2?": "./index.js",
},
output: {
crossOriginLoading: "anonymous",
},
plugins: [
new SubresourceIntegrityPlugin({
hashFuncNames: ["sha256"],
enabled: true,
}),
new HtmlWebpackPlugin(),
{
apply: (compiler) => {
compiler.hooks.done.tap("wsi-test", (stats) => {
expect(
stats.toJson().assets.find((asset) => asset.name == "why 1+1=2?.js")
).toHaveProperty("integrity");
});
},
},
],
};
2 changes: 1 addition & 1 deletion webpack-subresource-integrity/src/plugin.ts
Expand Up @@ -238,7 +238,7 @@ export class Plugin {
*/
private hwpAssetPath = (src: string): string => {
assert(this.hwpPublicPath !== null, "Missing HtmlWebpackPlugin publicPath");
return relative(this.hwpPublicPath, src);
return relative(this.hwpPublicPath, decodeURIComponent(src));
};

/**
Expand Down
13 changes: 13 additions & 0 deletions yarn.lock
Expand Up @@ -5518,6 +5518,19 @@ __metadata:
languageName: unknown
linkType: soft

"issue-221@workspace:examples/issue-221":
version: 0.0.0-use.local
resolution: "issue-221@workspace:examples/issue-221"
dependencies:
expect: ^26.6.2
html-webpack-plugin: ">= 5.0.0-beta.1"
nyc: "*"
webpack: ^5.44.0
webpack-cli: 4
webpack-subresource-integrity: "*"
languageName: unknown
linkType: soft

"istanbul-lib-coverage@npm:^3.0.0, istanbul-lib-coverage@npm:^3.2.0":
version: 3.2.0
resolution: "istanbul-lib-coverage@npm:3.2.0"
Expand Down

0 comments on commit 203429b

Please sign in to comment.