Skip to content

Commit

Permalink
feat: make plugin options optional (#145)
Browse files Browse the repository at this point in the history
* feat: make plugin options optional

* update test
  • Loading branch information
guybedford committed Aug 19, 2021
1 parent 505f983 commit 4cdf816
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/asset-relocator.js
Expand Up @@ -350,7 +350,7 @@ module.exports = async function (content, map) {
const dir = path.dirname(id);

// injection to set __webpack_require__.ab
const options = getOptions(this);
const options = getOptions(this) || {};

injectPathHook(this._compilation, options.outputAssetBase);

Expand Down
2 changes: 1 addition & 1 deletion test/project-chunking/expected.js
Expand Up @@ -6,4 +6,4 @@ expect(output.length).toBe(16);
// check relative asset references worked out
expect(fs.readFileSync(__dirname + "/dist/modules/main.js").toString()).toContain(`ab+"asset`);
expect(fs.readFileSync(__dirname + "/dist/modules/chunk.js").toString()).toContain(`ab+"asset`);
expect(fs.readFileSync(__dirname + "/dist/modules/chunks/541.js").toString()).toContain(`ab+"asset`);
expect(fs.readFileSync(__dirname + "/dist/modules/chunks/758.js").toString()).toContain(`ab+"asset`);
5 changes: 1 addition & 4 deletions test/project-chunking/webpack.config.js
Expand Up @@ -16,10 +16,7 @@ module.exports = {
test: /\.m?js$/,
parser: { amd: false },
use: {
loader: __dirname + '/../../src/asset-relocator.js',
options: {
wrapperCompatibility: true
}
loader: __dirname + '/../../src/asset-relocator.js'
}
}]
}
Expand Down

0 comments on commit 4cdf816

Please sign in to comment.