Skip to content

Instantly share code, notes, and snippets.

@jargnar
Created October 23, 2016 10:32
Show Gist options
  • Save jargnar/1def9bfb82915e9d9d2a6f515645aa90 to your computer and use it in GitHub Desktop.
Save jargnar/1def9bfb82915e9d9d2a6f515645aa90 to your computer and use it in GitHub Desktop.
Sample webpack config
var HtmlWebpackPlugin = require('html-webpack-plugin');
var HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: __dirname + '/app/index.html',
filename: 'index.html',
inject: 'body'
});
var CopyWebpackPlugin = require('copy-webpack-plugin');
var CopyWebpackPluginConfig = new CopyWebpackPlugin([
{
from: __dirname + '/app/static'
},
{
from: __dirname + '/app/css'
}
]);
module.exports = {
entry: [
__dirname + '/app/js/index.js'
],
output: {
path: __dirname + '/dist',
filename: 'index.bundle.js'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
},
{
test: /\.svg$/,
exclude: /node_modules/,
loader: 'file'
}
]
},
plugins: [
HtmlWebpackPluginConfig,
CopyWebpackPluginConfig
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment