-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.server-config.js
59 lines (56 loc) · 2.11 KB
/
webpack.server-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
var webpack = require('webpack');
var path = require('path');
var nodeExternals = require('webpack-node-externals');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var BUILD_DIR = path.resolve(__dirname, 'build');
var SRC_DIR = path.resolve(__dirname, 'src');
var config = {
target: 'node',
externals: [nodeExternals()], // in order to ignore all modules in node_modules folder
entry: SRC_DIR + '/server.js',
output: {
path: BUILD_DIR,
filename: 'server.js'
},
module : {
rules : [
{
test : /\.es6|\.jsx?$/,
use: [{
loader: 'babel-loader',
options: {
presets: [['es2015']],
plugins: ['syntax-dynamic-import']
}
}]
},
{
test: /\.css$/,
// loader: 'css-loader/locals' // skips emitting css: https://github.com/petehunt/node-jsx/issues/29
loader: ExtractTextPlugin.extract({fallback: "style-loader", use: "css-loader"})
},
{
test: /\.(jpg)$/, // for now handles only the .jpg referenced in the css file
// BADloader: 'file-loader?name=img/img-[hash:6].[ext]&outputPath=public/assets/'
// loader: 'file-loader?publicPath=assets/&name=./public/assets/img/[name]-[hash:6].[ext]'
// publicPath here affects only the jpg referenced in base.css
// loader: 'file-loader?publicPath=.././&name=./public/assets/img/[name]-[hash:6].[ext]'
loader: 'file-loader?outputPath=public/assets/&name=./img/[name]-[hash:6].[ext]'
},
{
test: /\.(png|gif)$/,
loader: 'file-loader?emitFile=false'
}
]
},
plugins: [
new ExtractTextPlugin("public/assets/styles.css")
// new ExtractTextPlugin("styles.css")
],
resolve: {
alias: {
'ag-grid-root': path.join(__dirname, 'node_modules', 'ag-grid')
}
}
}
module.exports = config