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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: webpack-contrib/file-loader
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.0.0
Choose a base ref
...
head repository: webpack-contrib/file-loader
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.0.1
Choose a head ref
  • 2 commits
  • 8 files changed
  • 2 contributors

Commits on Nov 25, 2019

  1. 6
    Copy the full SHA
    31d6589 View commit details
  2. chore(release): 5.0.1

    alexander-akait committed Nov 25, 2019
    Copy the full SHA
    90302cd View commit details
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [5.0.1](https://github.com/webpack-contrib/file-loader/compare/v5.0.0...v5.0.1) (2019-11-25)


### Bug Fixes

* name of `esModule` option in source code ([#346](https://github.com/webpack-contrib/file-loader/issues/346)) ([31d6589](https://github.com/webpack-contrib/file-loader/commit/31d6589b71b471f83908e80380dff9b9eada2d06))

## [5.0.0](https://github.com/webpack-contrib/file-loader/compare/v4.2.0...v5.0.0) (2019-11-22)


2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "file-loader",
"version": "5.0.0",
"version": "5.0.1",
"description": "A file loader module for webpack",
"license": "MIT",
"repository": "webpack-contrib/file-loader",
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -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;
19 changes: 19 additions & 0 deletions test/__snapshots__/esModule-option.test.js.snap
Original file line number Diff line number Diff line change
@@ -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 []`;
19 changes: 0 additions & 19 deletions test/__snapshots__/esModules-option.test.js.snap

This file was deleted.

4 changes: 2 additions & 2 deletions test/__snapshots__/validate-options.test.js.snap
Original file line number Diff line number Diff line change
@@ -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`] = `
2 changes: 1 addition & 1 deletion test/validate-options.test.js
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ describe('validate options', () => {
success: [/image\.png/, 'image.png'],
failure: [true],
},
esModules: {
esModule: {
success: [true, false],
failure: ['true'],
},