{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?optional[]=runtime'}
I installed babel-runtime
I use webpack with babel-loader config above, but get Object.assign is not function. How do I fix it?
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader?optional[]=runtime'}
I installed babel-runtime
I use webpack with babel-loader config above, but get Object.assign is not function. How do I fix it?
You will need to install babel-runtime.
npm install babel-runtime --save-dev
Then you can use the following as a loader in your webpack config -
{
test: /\.js?$/,
exclude: /node_modules/,
loaders: ['babel?optional=runtime']
}
or
{
test: /\.js?$/,
exclude: /node_modules/,
loader: 'babel-loader?optional=runtime'
}
It should work if you just use babel
as the loader:
{ test: /\.js$/, exclude: /node_modules/, loader: 'babel'}