This repository has been archived by the owner on Dec 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.js
84 lines (68 loc) · 2.19 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
'use strict';
const path = require('path');
const webpack = require('webpack');
const isRelease = process.env.NODE_ENV === 'production';
// XXX: we'd like to pass these values through `process.env`.
// But it would not work on Windows because cross-env v4 escapes `:` in the passed value.
// Then `C://Bar/Foo/` is replaced to `C;//Bar/Foo`. This causes the error which the path is incorrect.
// https://github.com/kentcdodds/cross-env/releases/tag/v4.0.0
// TODO: we may be able to restore the previous code by https://github.com/kentcdodds/cross-env/releases/tag/v5.0.0
const KAREN_ENTRY_POINT = path.resolve(__dirname, './__obj/client/karen.js');
const KAREN_CLIENT_DIST_DIR = path.resolve(__dirname, './__dist/client/');
console.log(`KAREN_ENTRY_POINT: ${KAREN_CLIENT_DIST_DIR}`);
console.log(`KAREN_CLIENT_DIST_DIR: ${KAREN_CLIENT_DIST_DIR}`);
const babelPresets = [
'react',
];
const babelPlugins = [
// esnext
'transform-async-generator-functions',
// some utilitis
'transform-inline-environment-variables',
'transform-node-env-inline',
];
const parserOpts = {};
const generatorOpts = {
// retain the parentheses around an IIFE
// see: https://github.com/nolanlawson/optimize-js
retainFunctionParens: false,
};
module.exports = {
bail: true,
devtool: isRelease ? '' : 'source-map',
entry: {
karen: KAREN_ENTRY_POINT,
},
output: {
path: KAREN_CLIENT_DIST_DIR,
filename: '[name].js',
},
externals: [
{
'moment': 'moment',
}
],
resolve: {
modules: ['node_modules'],
extensions: ['.js', '.jsx'],
alias: {},
},
module: {
rules: [
{
test: /\.jsx?$/, // loader is applied to files which matches this extensions.
exclude: /node_modules/, // don't transform under this path.
loader: 'babel-loader',
query: {
presets: babelPresets,
plugins: babelPlugins,
parserOpts,
generatorOpts,
}
}
]
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
]
};