This repository was archived by the owner on Jun 10, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathwebpack.config.server.js
More file actions
41 lines (40 loc) · 1.47 KB
/
webpack.config.server.js
File metadata and controls
41 lines (40 loc) · 1.47 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
const webpack = require('webpack');
const path = require('path');
const ROOT_PATH = path.resolve(__dirname);
module.exports = {
target: 'node',
entry: [
'./src/server/index.tsx'
],
output: {
path: path.resolve(__dirname, 'public'),
filename: '../build/server.js',
publicPath: '/public/',
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.jsx', '.css'],
alias: {
components: path.resolve(ROOT_PATH, 'build/src/client/components'),
features: path.resolve(ROOT_PATH, 'build/src/client/features'),
ui: path.resolve(ROOT_PATH, 'packages/ui/dist'),
test: path.resolve(ROOT_PATH, 'build/src/client/test'),
shared: path.resolve(ROOT_PATH, 'build/src/client/shared'),
root: path.resolve(ROOT_PATH, 'build/src/client/'),
},
},
module: {
rules: [
{ test: /\.tsx?$/, loaders: ['babel-loader', 'ts-loader'], include: [path.join(__dirname, 'src'), path.resolve(__dirname, 'packages')] },
{ test: /\.jsx?$/, exclude: /node_modules/, loaders: ['babel-loader'], include: path.join(__dirname, 'src') },
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.json$/, loader: 'json-loader' },
{ test: /\.md$/, loader: 'html!markdown-loader' },
],
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
'process.env.API_URL': JSON.stringify(process.env.API_URL || 'http://localhost:1338/api'),
}),
]
};