Created
October 23, 2016 10:32
-
-
Save jargnar/1def9bfb82915e9d9d2a6f515645aa90 to your computer and use it in GitHub Desktop.
Sample webpack config
This file contains 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
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