Created
December 5, 2016 03:35
-
-
Save hckhanh/86140412e68ef3f5ea1df15e75e1eb66 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 ExtractTextPlugin = require('extract-text-webpack-plugin'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
module.exports = { | |
entry: [ 'whatwg-fetch', './js/app.js' ], | |
output: { | |
filename: 'bundle.js', | |
path: __dirname + '/dist', | |
publicPath: '/' | |
}, | |
module: { | |
loaders: [ | |
{ | |
test: /\.js$/, | |
exclude: /node_modules/, | |
loader: 'babel-loader?compact=false', | |
}, | |
{ | |
test: /\.css$/, | |
loader: ExtractTextPlugin.extract('css-loader') | |
}, | |
{ | |
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2|ttf|eot)$/, | |
loader: "file-loader?name=assets/[name].[ext]" | |
} | |
] | |
}, | |
resolve: { | |
alias: { | |
// Bind version of jquery-ui | |
"jquery-ui": "jquery-ui/jquery-ui.js" | |
} | |
}, | |
plugins: [ | |
// Enables Hot Modules Replacement | |
new webpack.HotModuleReplacementPlugin(), | |
new webpack.ProvidePlugin({ | |
// Automtically detect jQuery and $ as free var in modules | |
// and inject the jquery library | |
// This is required by many jquery plugins | |
$: 'jquery', | |
jQuery: 'jquery' | |
}), | |
new ExtractTextPlugin('styles.css'), | |
new HtmlWebpackPlugin({ | |
template: 'index.html' | |
}) | |
] | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment