Skip to content
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

feat: make plugin options optional #145

Merged
merged 2 commits into from Aug 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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