Skip to content

Instantly share code, notes, and snippets.

@hckhanh
Created December 5, 2016 03:35
Show Gist options
  • Save hckhanh/86140412e68ef3f5ea1df15e75e1eb66 to your computer and use it in GitHub Desktop.
Save hckhanh/86140412e68ef3f5ea1df15e75e1eb66 to your computer and use it in GitHub Desktop.
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