Skip to content
Permalink
Browse files

fix: name of `esModule` option in source code (#346)

  • Loading branch information
evilebottnawi committed Nov 25, 2019
1 parent 2a18cba commit 31d6589b71b471f83908e80380dff9b9eada2d06
@@ -59,10 +59,10 @@ export default function loader(content) {
this.emitFile(outputPath, content);
}

const esModules =
typeof options.esModules !== 'undefined' ? options.esModules : true;
const esModule =
typeof options.esModule !== 'undefined' ? options.esModule : true;

return `${esModules ? 'export default' : 'module.exports ='} ${publicPath};`;
return `${esModule ? 'export default' : 'module.exports ='} ${publicPath};`;
}

export const raw = true;
@@ -0,0 +1,19 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`"esModule" option should work with "Boolean" value equal "false": errors 1`] = `Array []`;

exports[`"esModule" option should work with "Boolean" value equal "false": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;

exports[`"esModule" option should work with "Boolean" value equal "false": warnings 1`] = `Array []`;

exports[`"esModule" option should work with "Boolean" value equal "true": errors 1`] = `Array []`;

exports[`"esModule" option should work with "Boolean" value equal "true": result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;

exports[`"esModule" option should work with "Boolean" value equal "true": warnings 1`] = `Array []`;

exports[`"esModule" option should work without value: errors 1`] = `Array []`;

exports[`"esModule" option should work without value: result 1`] = `"9c87cbf3ba33126ffd25ae7f2f6bbafb.png"`;

exports[`"esModule" option should work without value: warnings 1`] = `Array []`;

This file was deleted.

@@ -12,9 +12,9 @@ exports[`validate options should throw an error on the "emitFile" option with "t
-> Enables/Disables emit files (https://github.com/webpack-contrib/file-loader#emitfile)."
`;

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

exports[`validate options should throw an error on the "name" option with "true" value 1`] = `
@@ -26,7 +26,7 @@ describe('validate options', () => {
success: [/image\.png/, 'image.png'],
failure: [true],
},
esModules: {
esModule: {
success: [true, false],
failure: ['true'],
},

0 comments on commit 31d6589

Please sign in to comment.
You can’t perform that action at this time.