Created
July 5, 2017 20:41
-
-
Save zackshapiro/8221a7a76d4f94e4e260b20f583671a8 to your computer and use it in GitHub Desktop.
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
const webpack = require('webpack'); | |
const path = require('path'); | |
module.exports = { | |
entry: { | |
app: ['webpack/hot/dev-server', './scripts/app.js'] | |
}, | |
output: { | |
filename: 'bundle.js', | |
publicPath: `/dist/` | |
}, | |
devServer: { | |
contentBase: path.join(__dirname, 'public'), | |
publicPath: '/dist/' | |
}, | |
module: { | |
rules: [ | |
{ | |
test: /\.jsx?$/, | |
enforce: "pre", | |
loader: "eslint-loader", | |
exclude: /node_modules/ | |
}, | |
{ | |
test: /\.jsx?$/, | |
loader: 'babel-loader', | |
exclude: /node_modules/, | |
query: { | |
presets: ['react', 'es2015', 'stage-3'] | |
} | |
}, | |
{ test: /\.css$/, loader: 'style-loader!css-loader' }, | |
{ test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'}, | |
{ test: /\.(ttf|eot|otf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }, | |
], | |
}, | |
plugins: [ | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.IgnorePlugin(new RegExp("^(fs|ipc)$")), | |
new webpack.LoaderOptionsPlugin({ | |
options: { | |
eslint: { | |
failOnWarning: false, | |
failOnError: true | |
} | |
} | |
}), | |
new webpack.DefinePlugin({ | |
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development'), | |
}), | |
] | |
} |
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
const webpack = require('webpack'); | |
const path = require('path'); | |
module.exports = { | |
entry: ['babel-polyfill', './main.js'], | |
output: { | |
path: __dirname, | |
filename: './main.prod.js' | |
}, | |
// this is the same as webpack.config.dev.js and everything below (except the environment default) | |
module: { | |
rules: [ | |
{ | |
test: /\.jsx?$/, | |
enforce: "pre", | |
loader: "eslint-loader", | |
exclude: /node_modules/ | |
}, | |
{ | |
test: /\.jsx?$/, | |
loader: 'babel-loader', | |
exclude: /node_modules/, | |
query: { | |
presets: ['react', 'es2015', 'stage-3'] | |
} | |
}, | |
{ test: /\.css$/, loader: 'style-loader!css-loader' }, | |
{ test: /\.scss$/, loader: 'style-loader!css-loader!sass-loader'}, | |
{ test: /\.(ttf|eot|otf|svg)(\?v=[0-9]\.[0-9]\.[0-9])?$/, loader: "file-loader" }, | |
], | |
}, | |
plugins: [ | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.IgnorePlugin(new RegExp("^(fs|ipc)$")), | |
new webpack.LoaderOptionsPlugin({ | |
options: { | |
eslint: { | |
failOnWarning: false, | |
failOnError: true | |
} | |
} | |
}), | |
new webpack.DefinePlugin({ | |
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'), | |
}), | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment