Skip to content

Remove automatic -loader module name extension - #3102

Merged
jhnns merged 6 commits into
webpack:masterfrom
amsdamsgram:remove-automatic-loader-extension
Oct 25, 2016
Merged

jhnns merged 6 commits into
webpack:masterfrom
amsdamsgram:remove-automatic-loader-extension

Conversation

@amsdamsgram

@amsdamsgram amsdamsgram commented Oct 6, 2016 •

Copy link
Copy Markdown

RESOLVING CONFLICTS

  • Tests for the changes have been added (for bug fixes / features)

No tests have been added. As @jhnns said

Tests should usually check for actual behavior, not for behavior that used to be there.

  • Docs have been added / updated (for bug fixes / features)

Loader part on the new documentation is not written yet.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior? (You can also link to an open issue here)
webpack automatically appends -loader to a module when the first module lookup failed

What is the new behavior?
webpack should not append -loader

Does this PR introduce a breaking change?

  • Yes
  • No

If this PR contains a breaking change, please describe the following...

  • Impact: everyone who is using module name without -loader will have adjust their webpack configs
  • Migration path for existing applications: always append -loader at the end of module name in webpack config
  • Github Issue(s) this is regarding: Remove automatic -loader module name extension #2986

Comment thread examples/loader/example.js Outdated
// use buildin json loader
console.dir(require("./test.json")); // default by extension
console.dir(require("!json!./test.json")); // manual No newline at end of file
console.dir(require("!json!./test.json")); // manual

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look like json-loader 😉

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

Comment thread examples/loader/webpack.config.js Outdated
@@ -4,4 +4,4 @@ module.exports = {
{ test: /\.json$/, loader: "json" }

@Jessidhia Jessidhia Oct 6, 2016 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also looks like it needs updating

@amsdamsgram amsdamsgram changed the title fix-2986: Remove automatic -loader module name extension Remove automatic -loader module name extension Oct 6, 2016
@@ -1,12 +1,12 @@
var webpack = require("../../");
module.exports = {
plugins: [

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like you've converted tabs to spaces. Please revert that change here.

@jhnns

jhnns commented Oct 19, 2016

Copy link
Copy Markdown
Contributor

These changes look good. Currently, there's one failing test but this test is currently also failing on master so it's not related to this change.

Could you revert the whitespace change (as requested) and rebase the branch against master to make it up-to-date?

@amsdamsgram
amsdamsgram force-pushed the remove-automatic-loader-extension branch from db96d81 to bc3ff40 Compare October 25, 2016 08:54
@amsdamsgram

Copy link
Copy Markdown
Author

@jhnns Should be good now!

@jhnns jhnns left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jhnns
jhnns merged commit a3bfd1e into webpack:master Oct 25, 2016
@jhnns

jhnns commented Oct 25, 2016

Copy link
Copy Markdown
Contributor

@iDams awesome, thanks! 👍

jhnns added a commit to webpack/webpack.js.org that referenced this pull request Oct 25, 2016
Aligns with breaking change introduced with webpack/webpack#3102
See webpack/webpack#2986
@amsdamsgram

Copy link
Copy Markdown
Author

@jhnns yay!

chunk {1} hash.worker.js (main) 168 bytes [entry] [rendered]
> main [1] ./worker.js
[1] ./worker.js 168 bytes {1} [built]
>>>>>>> fix-2986: Remove automatic -loader module name extension

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git conflict!

@amsdamsgram amsdamsgram Nov 2, 2016 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arf :/
@sokra Should I make a PR to fix it?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha, damn it!
PR is ready: #3227

jhnns added a commit that referenced this pull request Nov 2, 2016
niieani added a commit to easy-webpack/config-babel that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-css that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-eslint that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-external-source-maps that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-fonts-and-images that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-global-bluebird that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-global-jquery that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-html that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-json that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-less that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-pug that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-sass that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-test-coverage-istanbul that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-tslint that referenced this pull request Nov 8, 2016
niieani added a commit to easy-webpack/config-typescript that referenced this pull request Nov 8, 2016
epixa added a commit to epixa/kibana that referenced this pull request Dec 20, 2016
Webpack v1 checks for the exact package name as the given loader name
before adding the -loader suffix, which is what we really want.
Unfortunately, this can mean that webpack can accidentally pick up
non-webpacker loader modules if they are at the top level of the
dependency graph, which is far more likely in npm 3+.

Webpack v2 will require all loaders to be explicitly named with the
-loader suffix (where appropriate), so this change gets us closer to
that anyway. See webpack/webpack#3102
epixa added a commit to elastic/kibana that referenced this pull request Dec 20, 2016
Webpack v1 checks for the exact package name as the given loader name
before adding the -loader suffix, which is what we really want.
Unfortunately, this can mean that webpack can accidentally pick up
non-webpacker loader modules if they are at the top level of the
dependency graph, which is far more likely in npm 3+.

Webpack v2 will require all loaders to be explicitly named with the
-loader suffix (where appropriate), so this change gets us closer to
that anyway. See webpack/webpack#3102
elastic-jasper added a commit to elastic/kibana that referenced this pull request Dec 20, 2016
Backports PR #9576

**Commit 1:**
build: -loader suffix for all webpack loaders

Webpack v1 checks for the exact package name as the given loader name
before adding the -loader suffix, which is what we really want.
Unfortunately, this can mean that webpack can accidentally pick up
non-webpacker loader modules if they are at the top level of the
dependency graph, which is far more likely in npm 3+.

Webpack v2 will require all loaders to be explicitly named with the
-loader suffix (where appropriate), so this change gets us closer to
that anyway. See webpack/webpack#3102

* Original sha: 19f2a34
* Authored by Court Ewing <[email protected]> on 2016-12-20T20:00:26Z
epixa added a commit to elastic/kibana that referenced this pull request Dec 20, 2016
Webpack v1 checks for the exact package name as the given loader name
before adding the -loader suffix, which is what we really want.
Unfortunately, this can mean that webpack can accidentally pick up
non-webpacker loader modules if they are at the top level of the
dependency graph, which is far more likely in npm 3+.

Webpack v2 will require all loaders to be explicitly named with the
-loader suffix (where appropriate), so this change gets us closer to
that anyway. See webpack/webpack#3102
epixa pushed a commit to elastic/kibana that referenced this pull request Dec 20, 2016
Backports PR #9576

**Commit 1:**
build: -loader suffix for all webpack loaders

Webpack v1 checks for the exact package name as the given loader name
before adding the -loader suffix, which is what we really want.
Unfortunately, this can mean that webpack can accidentally pick up
non-webpacker loader modules if they are at the top level of the
dependency graph, which is far more likely in npm 3+.

Webpack v2 will require all loaders to be explicitly named with the
-loader suffix (where appropriate), so this change gets us closer to
that anyway. See webpack/webpack#3102

* Original sha: 19f2a34
* Authored by Court Ewing <[email protected]> on 2016-12-20T20:00:26Z
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request May 6, 2026
Webpack v1 checks for the exact package name as the given loader name
before adding the -loader suffix, which is what we really want.
Unfortunately, this can mean that webpack can accidentally pick up
non-webpacker loader modules if they are at the top level of the
dependency graph, which is far more likely in npm 3+.

Webpack v2 will require all loaders to be explicitly named with the
-loader suffix (where appropriate), so this change gets us closer to
that anyway. See webpack/webpack#3102
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants