Changed webpack stuff for deployment

This commit is contained in:
2017-03-03 18:14:33 +00:00
parent 537ab5f64e
commit af06e2e066
5 changed files with 79 additions and 4 deletions

39
webpack/base.conf.js Normal file
View File

@ -0,0 +1,39 @@
var path = require("path");
var HtmlWebpackPlugin = require("html-webpack-plugin");
module.exports = {
context: path.join(__dirname, "..", "src"),
entry: "./index.js",
output: {
path: path.join(__dirname, "..", "build"),
filename: "app.js"
},
plugins: [
new HtmlWebpackPlugin({
template: "./index.html"
})
],
module: {
rules: [
{
test: /\.scss$/,
use: [{
loader: "style-loader"
}, {
loader: "css-loader"
}, {
loader: "sass-loader"
}]
},
{
test: /\.hbs$/,
use: [
{
loader: "handlebars-loader"
}
]
}
]
}
}
//SASS code from https://github.com/jtangelder/sass-loader licensed under MIT, see https://github.com/jtangelder/sass-loader/blob/master/LICENSE

3
webpack/dev.conf.js Normal file
View File

@ -0,0 +1,3 @@
var config = require("./base.conf.js");
config.devtool = "source-map";
module.exports = config;

16
webpack/prod.conf.js Normal file
View File

@ -0,0 +1,16 @@
var config = require("./base.conf.js");
var webpack = require("webpack");
config.module.rules.push({
test: /\.js$/,
exclude: /node_modules/,
use: [
{
loader: "babel-loader",
query: {
presets: ["es2015"]
}
}
]
});
config.plugins.push(new webpack.optimize.UglifyJsPlugin());
module.exports = config;