Last active
March 7, 2017 20:34
-
-
Save tribou/6b8876393f251c19a97b to your computer and use it in GitHub Desktop.
Including Babel.js and ESlint with Webpack
This file contains 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
// Webpack config file | |
var BrowserSyncPlugin = require('browser-sync-webpack-plugin'); | |
module.exports = { | |
entry: './assets/js/components/Index.jsx', | |
output: { | |
path: __dirname + '/assets/js', | |
filename: 'bundle.js' | |
}, | |
module: { | |
preLoaders: [ | |
{ | |
test: /\.jsx$|\.js$/, | |
loader: 'eslint-loader', | |
include: __dirname + '/assets', | |
exclude: /bundle\.js$/ | |
} | |
], | |
loaders: [ | |
{ | |
test: /\.jsx$|\.js$/, | |
loader: 'babel-loader', | |
exclude: /node_modules/ | |
} | |
] | |
}, | |
plugins: [ | |
new BrowserSyncPlugin({ | |
proxy: 'localhost:8000' | |
}) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to save a couple of characters, you can shave off a few by adjusting the test pattern to:
But thanks loads for the article. I'm trying to cram my head with React at the moment, and am attempting to learn it with ES6/2015 from the beginning. These tips help!