Skip to content

Loader crashes when no options are supplied #412

@billyjanitsch

Description

@billyjanitsch

I'm submitting a bug report

Webpack Version:
2.2.1

Babel Core Version:
6.23.1

Babel Loader Version:
7.0.0-alpha.2

Please tell us about your environment:
OSX 10.12.3

Current behavior:
babel-loader crashes when no options are supplied:

Module build failed: TypeError: Cannot read property 'babelrc' of null

Expected/desired behavior:
Supplying no options should be supported.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.
{
  test: /\.js$/,
  use: 'babel-loader',
  // don't pass any options to the loader
}

The issue is that loader-utils' getOptions returns null if no options are supplied to the loader, so you can't access properties assuming that it will be an object. Appending || {} to L96 should fix it, but I haven't had a chance to verify.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions