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

babelrc-related bugfixes #494

Closed
wants to merge 1 commit into from
Closed

babelrc-related bugfixes #494

wants to merge 1 commit into from

Conversation

mitranim
Copy link

  • don't try to load missing babelrc (false check was too narrow)
  • don't swallow non-FS errors when checking if file exists

* don't try to load missing babelrc (`false` check was too narrow)
* don't swallow non-FS errors when checking if file exists
@@ -112,7 +112,7 @@ module.exports = function(source, inputSourceMap) {
const loaderOptions = loaderUtils.getOptions(this) || {};
const fileSystem = this.fs ? this.fs : fs;
let babelrcPath = null;
if (loaderOptions.babelrc !== false) {
Copy link
Member

Choose a reason for hiding this comment

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

That completely changes the behaviour for when not setting babelrc option.

@danez
Copy link
Member

danez commented Jul 25, 2017

Can you describe what problem you actually try to resolve?

@mitranim
Copy link
Author

The problematic scenario is very basic, I'm surprised other people don't complain.

  • webpack@3.3.0 + babel-loader@7.1.1
  • .babelrc in project root
  • rudimentary webpack config with use: {loader: 'babel-loader'} and no plugin options
  • run webpack --watch, touch a file → webpack blows up and dies

Specifically: babel-loader attempts to check for existence of babelrc with the undefined name (not a string, just undefined), passing it to Webpack's virtual filesystem, which assumes that the file name is a string and produces a synchronous exception.

Checking for false is naive. By default, most users won't specify a babelrc location, meaning the option is undefined. The change accommodates the most common use case while keeping the same general logic.

@zythum
Copy link

zythum commented Jul 27, 2017

because enhanced-resolve updated api. if exist
path is undefined will threw error webpack/enhanced-resolve#100

@danez
Copy link
Member

danez commented Jul 29, 2017

Merged in #495

@danez danez closed this Jul 29, 2017
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.

3 participants