Skip to content

Instantly share code, notes, and snippets.

@tribou
Last active March 7, 2017 20:34
Show Gist options
  • Save tribou/6b8876393f251c19a97b to your computer and use it in GitHub Desktop.
Save tribou/6b8876393f251c19a97b to your computer and use it in GitHub Desktop.
Including Babel.js and ESlint with Webpack
// 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'
})
]
};
@billturner
Copy link

If you want to save a couple of characters, you can shave off a few by adjusting the test pattern to:

test: /\.jsx?$/

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment