This repository was archived by the owner on Jul 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
70 lines (67 loc) · 2.15 KB
/
webpack.config.js
File metadata and controls
70 lines (67 loc) · 2.15 KB
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
const path = require('path');
const webpack = require('webpack');
if (process.env.NODE_ENV !== 'production') {
require('dotenv').config();
}
/** @type {webpack.Configuration} */
const webpackConfig = {
mode: process.env.NODE_ENV || 'production',
entry: ['babel-polyfill', './src/client/index.tsx'],
output: {
path: path.resolve(__dirname, './src/web-root'),
filename: 'mplan.js',
},
module: {
rules: [
{
test: /\.tsx?$/,
use: [
{
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env'],
plugins: [require('babel-plugin-styled-components')],
},
},
{ loader: 'awesome-typescript-loader' },
],
},
{
test: /\.css/,
use: [{ loader: 'style-loader' }, { loader: 'css-loader', options: { minimize: true } }],
},
],
},
resolve: {
extensions: ['.tsx', '.ts', '.js', '.jsx', '.css'],
alias: {
recordize: path.resolve(__dirname, './src/recordize'),
styles: path.resolve(__dirname, './src/client/styles'),
models: path.resolve(__dirname, './src/models'),
utilities: path.resolve(__dirname, './src/utilities'),
components: path.resolve(__dirname, './src/client/components'),
routes: path.resolve(__dirname, './src/client/routes'),
client: path.resolve(__dirname, './src/client'),
server: path.resolve(__dirname, './src/server'),
sync: path.resolve(__dirname, './src/sync'),
},
},
devtool: 'source-map',
devServer: {
contentBase: path.resolve(__dirname, './src/web-root'),
historyApiFallback: true,
proxy: {
'/api': 'http://localhost:8090',
},
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'process.env.TEST_USERNAME': JSON.stringify(process.env.TEST_USERNAME),
'process.env.AUTHORIZATION_URI': JSON.stringify(process.env.AUTHORIZATION_URI),
'process.env.CLIENT_ID': JSON.stringify(process.env.CLIENT_ID),
'process.env.REDIRECT_URI': JSON.stringify(process.env.REDIRECT_URI),
}),
],
};
module.exports = webpackConfig;