-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from waysact/issue-131
Fix hash lookup for dynamic chunks
- Loading branch information
Showing
7 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# With a modified dynamically loaded chunk #hwp | ||
|
||
Ensure that when a chunk is modified, it fails to load. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('this should never load'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import("./corrupt").then(function error() { | ||
console.log('error'); | ||
}).catch(function ok() { | ||
console.log('ok'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var webpackVersionComponents = require('webpack/package.json').version.split( | ||
'.' | ||
); | ||
var webpackVersionMajor = Number(webpackVersionComponents[0]); | ||
|
||
var defaultCheck = require("../../test/defaultCheck"); | ||
var fs = require('fs'); | ||
|
||
module.exports.skip = function skip() { | ||
return webpackVersionMajor < 2; | ||
}; | ||
|
||
module.exports.check = function check(stats, url, browser) { | ||
const otherAsset = Object.keys(stats.compilation.assets).find(key => key !== 'index.js' && key.endsWith(".js")); | ||
fs.writeFileSync('dist/' + otherAsset, 'xxx'); | ||
|
||
return defaultCheck(stats, url, browser); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
var SriPlugin = require('webpack-subresource-integrity'); | ||
var HtmlWebpackPlugin = require('html-webpack-plugin'); | ||
|
||
module.exports = { | ||
entry: { | ||
index: './index.js' | ||
}, | ||
output: { | ||
crossOriginLoading: 'anonymous' | ||
}, | ||
plugins: [ | ||
new SriPlugin({ | ||
hashFuncNames: ['sha256', 'sha384'], | ||
enabled: true | ||
}), | ||
new HtmlWebpackPlugin() | ||
] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters