Skip to content

Instantly share code, notes, and snippets.

@ivportilla
Created May 16, 2017 15:59
Show Gist options
  • Save ivportilla/2a87f0cd8ff44eeb563e0290cb3574b6 to your computer and use it in GitHub Desktop.
Save ivportilla/2a87f0cd8ff44eeb563e0290cb3574b6 to your computer and use it in GitHub Desktop.
Webpack config
const path = require('path');
const webpack = require('webpack');
const apiHost = require('./src/config/deploy.config');
module.exports = {
entry: './src/frontend/app/index.js',
output: {
path: path.resolve(__dirname, './src/frontend/dist'),
filename: 'bundle.js'
},
resolve: {
modules: [
'node_modules'
]
},
module: {
rules: [
{
test: /\.js$/,
exclude: /(node_modules|components)/,
loader: 'babel-loader',
query: {
presets: ["es2015"]
}
},
{ test: /\.html$/, use: 'html-loader' }
]
},
devServer: {
contentBase: path.join(__dirname, "src/frontend/dist"),
compress: true,
port: 9000,
historyApiFallback: true
},
plugins: [
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
new webpack.optimize.UglifyJsPlugin(),
new webpack.DefinePlugin({
__API__: apiHost
})
]
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment