-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
67 lines (62 loc) · 2.08 KB
/
webpack.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
const path = require('path');
const BabiliPlugin = require("babili-webpack-plugin");
// Workaround for remote server build & deploy problems
// npm skips installing devDependencies{} if NODE_ENV=="production"
// But webpack needs those deps to build! Sure there's a nicer way but #fornow:
const PRODUCTION_STR = "buildproduction";
const ENV_STR = (process.env.NODE_ENV == PRODUCTION_STR) ?
"\x1b[97m\x1b[41m PRODUCTION \x1b[0m" : "\x1b[97m\x1b[44m DEVELOPMENT \x1b[0m";
console.log(`\n\x1b[97m 💅 Building\x1b[0m [${ENV_STR}]\n`);
module.exports = [
{
context: path.join(__dirname, "core"),
entry: './main.ts',
// devtool: "inline-sourcemap",
devtool: "source-map",
output: {
path: path.join(__dirname, "pub"),
publicPath: "/",
filename: "main.build.js"
},
module: {
rules: [ //see: https://webpack.js.org/guides/migrating/
{
test: /\.tsx?$/,
loader: 'ts-loader'
},
{
test: /\.js$/,
exclude: /(node_modules)/,
use: [
{
loader: 'babel-loader',
// options: { presets: ['es2015'] } // <-- produces deprecation warning... necessary?
}
]
},
{
enforce: "pre",
test: /\.js$/,
loader: "source-map-loader"
}
]
// loaders: [
// {
// test: /\.js$/,
// exclude: /(node_modules)/,
// loader: 'babel-loader',
// query: {
// presets: ['es2015']
// }
// }
// ]
},
resolve: {
extensions: ['.ts','.js', '.json']
},
plugins: process.env.NODE_ENV != PRODUCTION_STR ? [] :
[
new BabiliPlugin({removeConsole:false}, {comments: false, sourceMap: false})
]
}
];