Skip to content
This repository was archived by the owner on Mar 17, 2021. It is now read-only.

Commit 31d6589

Browse files
fix: name of esModule option in source code (#346)
1 parent 2a18cba commit 31d6589

5 files changed

+25
-25
lines changed

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,10 @@ export default function loader(content) {
5959
this.emitFile(outputPath, content);
6060
}
6161

62-
const esModules =
63-
typeof options.esModules !== 'undefined' ? options.esModules : true;
62+
const esModule =
63+
typeof options.esModule !== 'undefined' ? options.esModule : true;
6464

65-
return `${esModules ? 'export default' : 'module.exports ='} ${publicPath};`;
65+
return `${esModule ? 'export default' : 'module.exports ='} ${publicPath};`;
6666
}
6767

6868
export const raw = true;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`"esModule" option should work with "Boolean" value equal "false": errors 1`] = `Array []`;
4+
5+
exports[`"esModule" option should work with "Boolean" value equal "false": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
6+
7+
exports[`"esModule" option should work with "Boolean" value equal "false": warnings 1`] = `Array []`;
8+
9+
exports[`"esModule" option should work with "Boolean" value equal "true": errors 1`] = `Array []`;
10+
11+
exports[`"esModule" option should work with "Boolean" value equal "true": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
12+
13+
exports[`"esModule" option should work with "Boolean" value equal "true": warnings 1`] = `Array []`;
14+
15+
exports[`"esModule" option should work without value: errors 1`] = `Array []`;
16+
17+
exports[`"esModule" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;
18+
19+
exports[`"esModule" option should work without value: warnings 1`] = `Array []`;

test/__snapshots__/esModules-option.test.js.snap

Lines changed: 0 additions & 19 deletions
This file was deleted.

test/__snapshots__/validate-options.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ exports[`validate options should throw an error on the "emitFile" option with "t
1212
-> Enables/Disables emit files (https://github.com/webpack-contrib/file-loader#emitfile)."
1313
`;
1414

15-
exports[`validate options should throw an error on the "esModules" option with "true" value 1`] = `
15+
exports[`validate options should throw an error on the "esModule" option with "true" value 1`] = `
1616
"Invalid options object. File Loader has been initialised using an options object that does not match the API schema.
17-
- options.esModules should be a boolean."
17+
- options.esModule should be a boolean."
1818
`;
1919

2020
exports[`validate options should throw an error on the "name" option with "true" value 1`] = `

test/validate-options.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('validate options', () => {
2626
success: [/image\.png/, 'image.png'],
2727
failure: [true],
2828
},
29-
esModules: {
29+
esModule: {
3030
success: [true, false],
3131
failure: ['true'],
3232
},

0 commit comments

Comments
 (0)