Skip to content Skip to sidebar Skip to footer

Unable To Load Stage-3 Javascript File Using Babel-loader From Webpack

Overview Following the Auth0 documentation, they have a JavaScript file that has field variables (stage-3). When running my app, I get the following error: ERROR in ./src/auth/Auth

Solution 1:

I've found that most people that have had webpack problems (after ruling out the loader issue) have the issue because there is something incorrect setup in your webpack config.

For my webpack config, I needed to change this:

  module: {
    rules: [
      // ...
      {
        test: /\.js$/,
        loader: 'babel-loader',
        include: [path.join(__dirname, '..', 'src')],
      },
      // ...
    ]
  },

to this:

module: {
    rules: [
      // ...
      {
        test: /\.js$/,
        loader: 'babel-loader',
        exclude: /node_modules/,
      },
      // ...
    ]
  },

Because my webpack.config.js file existed under src, so the issue might've been that the .. argument in my include property wasn't pointing to the right folder to look for .js files in.

I needed to exclude node_modules because it would otherwise try to parse files in that directory.

Post a Comment for "Unable To Load Stage-3 Javascript File Using Babel-loader From Webpack"