Skip to content

Instantly share code, notes, and snippets.

@cowboy
Created September 16, 2016 16:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save cowboy/71f8c8c0bc6df609c44ee2aafad59d6f to your computer and use it in GitHub Desktop.
Save cowboy/71f8c8c0bc6df609c44ee2aafad59d6f to your computer and use it in GitHub Desktop.
Webpack: build error converting a lib's ... spread operator to ES5?
// npm install && npm run build
// In output.js, spreadTest(...args) is converted to ES5
function spreadTest(...args) {
return args;
}
console.log(spreadTest(1, 2, 3));
// But the ...args inside of this lib's "audit" function is NOT converted to ES5
import 'react-axe';
{
"name": "webpack-react-axe",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"build": "webpack"
},
"author": "",
"license": "ISC",
"dependencies": {
"react-axe": "^1.0.6"
},
"devDependencies": {
"babel-core": "^6.14.0",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.14.0",
"webpack": "^1.13.2"
}
}
var path = require('path');
module.exports = {
entry: path.join(__dirname, 'index.js'),
output: {
path: __dirname,
filename: 'output.js',
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['es2015'],
},
},
],
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment