-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.server.js
More file actions
55 lines (50 loc) · 1.29 KB
/
Copy pathwebpack.server.js
File metadata and controls
55 lines (50 loc) · 1.29 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
const path = require('path');
const webpackNodeExternals = require('webpack-node-externals');
const IsomorphicLoaderPlugin = require("isomorphic-loader/lib/webpack-plugin");
const config = {
// Inform webpack that we're building a bundle
// for nodeJS, rather than for the browser
target: 'node',
// Tell webpack the root file of our server application
entry: './src/_server.js',
// Tell webpack where to put the output file that is generated
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'build')
},
module: {
rules: [
{
test: /\.(jpe?g|png|gif|svg)$/i,
loader: "file-loader!isomorphic-loader"
},
{
test: /\.css$/,
use: ['isomorphic-style-loader', { loader: 'css-loader' }]
},
{
test: /\.js?$/,
use: [
{
loader: 'babel-loader',
options: {
compact: false,
presets: [
'@babel/react',
'@babel/env'
],
plugins: [
"@babel/plugin-proposal-class-properties"
]
}
}
]
}
]
},
plugins: [
new IsomorphicLoaderPlugin()
],
externals: [webpackNodeExternals()]
};
module.exports = config;