babel-loader doesnt generate external-helpers

Created on 13 Nov 2015  路  9Comments  路  Source: babel/babel-loader

If you add "external-helpers-2" plugin, you will get an error: babelHelpers is not defined.

Most helpful comment

Any progress on this issue? Any workaround is really welcome

All 9 comments

I have the same problem here any hint?

Any progress on this issue? Any workaround is really welcome

The same happens w/ babel-loader v6.4 & babel-plugin-external-helpers v6.5:
Uncaught ReferenceError: babelHelpers is not defined

Webpack config:

var path = require('path');
var webpack = require('webpack');

module.exports = function (options) {
    var dev = options.dev;

    var plugins = [
        new webpack.NoErrorsPlugin(),
        new webpack.DefinePlugin({
            'process.env.NODE_ENV': JSON.stringify(dev ? 'development' : 'production'),
        })
    ].concat(dev ? [] : [
        new webpack.optimize.UglifyJsPlugin()
    ]);

    return {
        debug: dev,
        devtool: dev ? 'source-map' : '',
        entry: {
            main: [
                path.resolve(__dirname, 'assets/js/main.js')
            ]
        },
        output: {
            path: path.resolve(__dirname, 'public/js'),
            filename: '[name].js'
        },
        plugins: plugins,
        resolve: {
            extensions: ['', '.js'],
            modules: [
                path.resolve(__dirname, 'Resources/assets/js'),
                'node_modules'
            ]
        },
        module: {
            loaders: [
                {
                    test: /\.js$/,
                    loaders: [
                        {
                            loader: 'babel-loader',
                            query: {
                                presets: ['es2015', 'stage-2'],
                                plugins: ['external-helpers']
                            }
                        }
                    ]
                }
            ]
        }
    };
};

+1

Any update ?

I am also regularly running into this issue.
@foisonocean I pulled in your branch but get Uncaught TypeError: babelHelpers.typeof is not a function

+1

As of the release of Babel 7, I'd recommend avoiding babel-plugin-external-helpers in pretty much all cases in favor of the pairing of @babel/plugin-transform-runtime and @babel/runtime.

If you do want to use external helpers, it is your responsibility to write them to a file and load them into your bundle.

Was this page helpful?
0 / 5 - 0 ratings