Babel Transform Runtime issue with Webpack 2

Viewed 1537

Good afternoon,

This is the same issue I reported at webpack's github, but I suspect I might be the one doing something wrong, thus opening a question here.

I'm trying to configure webpack 2 with Babel, and one of the requirements is to transpile built-ins such as Symbol.

Despite that now working fine, when I try to use webpack and babel's transform-runtime, I'm unable to use exports *.

Input file (src/index.js):

export * from './secondFile'

secondFile.js:

export let TESTSYMBOL = Symbol('test');

export let TESTSYMBOL2 = Symbol('test2');

webpack.config.js (only copied the relevant part):

module: {
    rules: [
        {
            test: /\.jsx?$/,
            // Skip any files outside of `src` directory
            include:path.resolve(__dirname, 'src'),
            use: {
                loader: 'babel-loader',
                options: {
                    presets: ["es2015", "stage-3"],
                    plugins: ['transform-runtime']
                }
            }
        }
    ]
}

script:

"webpack -d --config config/webpack.config.js"

Output file: gist

Exception:

Uncaught ReferenceError: exports is not defined - at Object.defineProperty(exports, "__esModule", {

Dev Dependencies:

  • "webpack": "2.6.1",
  • "webpack-dev-server": "2.4.5",
  • "webpack-notifier": "1.5.0"
  • "babel-cli": "6.24.1",
  • "babel-loader": "7.0.0",
  • "babel-plugin-transform-runtime": "6.23.0",
  • "babel-preset-es2015": "6.24.1",
  • "babel-preset-stage-3": "6.24.1"

Dependencies: - "babel-runtime": "6.23.0"

Thanks for any help!

2 Answers
Related