Changed webpack stuff for deployment
This commit is contained in:
parent
537ab5f64e
commit
af06e2e066
@ -4,8 +4,8 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "webpack",
|
"build": "webpack --config webpack/prod.conf.js",
|
||||||
"dev-server": "webpack-dev-server --watch --progress --colors"
|
"dev-server": "webpack-dev-server --watch --progress --colors --config webpack/dev.conf.js"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -18,6 +18,9 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/TimStallard/CryptoAssist#readme",
|
"homepage": "https://github.com/TimStallard/CryptoAssist#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"babel-core": "^6.23.1",
|
||||||
|
"babel-loader": "^6.3.2",
|
||||||
|
"babel-preset-es2015": "^6.22.0",
|
||||||
"chart.js": "^2.5.0",
|
"chart.js": "^2.5.0",
|
||||||
"css-loader": "^0.26.1",
|
"css-loader": "^0.26.1",
|
||||||
"file-saver": "^1.3.3",
|
"file-saver": "^1.3.3",
|
||||||
|
@ -11,7 +11,8 @@ module.exports = {
|
|||||||
plugins: [
|
plugins: [
|
||||||
new HtmlWebpackPlugin({
|
new HtmlWebpackPlugin({
|
||||||
template: "./index.html"
|
template: "./index.html"
|
||||||
})
|
}),
|
||||||
|
new webpack.optimize.UglifyJsPlugin()
|
||||||
],
|
],
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
@ -32,9 +33,22 @@ module.exports = {
|
|||||||
loader: "handlebars-loader"
|
loader: "handlebars-loader"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.js$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
use: [
|
||||||
|
{
|
||||||
|
loader: "babel-loader",
|
||||||
|
query: {
|
||||||
|
presets: ["es2015"]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
devtool: "source-map"
|
||||||
}
|
}
|
||||||
|
|
||||||
//SASS code from https://github.com/jtangelder/sass-loader licensed under MIT, see https://github.com/jtangelder/sass-loader/blob/master/LICENSE
|
//SASS code from https://github.com/jtangelder/sass-loader licensed under MIT, see https://github.com/jtangelder/sass-loader/blob/master/LICENSE
|
||||||
|
39
webpack/base.conf.js
Normal file
39
webpack/base.conf.js
Normal 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
3
webpack/dev.conf.js
Normal 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
16
webpack/prod.conf.js
Normal 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;
|
Loading…
x
Reference in New Issue
Block a user