Created
September 16, 2016 16:01
-
-
Save cowboy/71f8c8c0bc6df609c44ee2aafad59d6f to your computer and use it in GitHub Desktop.
Webpack: build error converting a lib's ... spread operator to ES5?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"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" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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