-
Notifications
You must be signed in to change notification settings - Fork 9
/
webpack.config.headless.js
72 lines (65 loc) · 1.81 KB
/
webpack.config.headless.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
// config specific to headless/ server side renderer build
var fs = require('fs')
var path = require('path')
var webpack = require('webpack')
var srcPath = 'src'
// add any extra folders we want to apply loaders to
var pathsToInclude = path.join(__dirname, srcPath)
var nodeModules = {}
fs.readdirSync('node_modules')
.filter(function (x) {
return ['.bin'].indexOf(x) === -1
})
.forEach(function (mod) {
nodeModules[mod] = 'commonjs ' + mod
})
var config = {
// devtool: 'sourcemap',
target: 'node',
entry: [
'./' + srcPath + '/components/webgl/serverSide/rendererCLI.js'
],
output: {
path: path.join(__dirname, 'dist'),
filename: 'jam-headless.js',
publicPath: '/dist/' // '/'+'dist'+'/'
},
plugins: [
new webpack.IgnorePlugin(/\.(css|less)$/),
new webpack.ProvidePlugin({
rx: 'rx',
Rx: 'rx',
'window.Rx': 'rx'
})
],
externals: nodeModules,
module: {
loaders: [
{ test: /\.js?$/, loaders: ['babel'], include: pathsToInclude, exclude: /(node_modules|bower_components)/ }
],
noParse: /\.min\.js/
},
resolve: {
extensions: ['', '.js'],
root: [
path.join(__dirname, 'node_modules')
]
},
resolveLoader: {
root: path.join(__dirname, 'node_modules')
}
}
// console.log("production",production,"dev",dev)
config.bail = true
config.debug = false
config.profile = false
config.output.pathInfo = false
config.output.publicPath = './dist/' // withouth this, issues with webworker paths
// config.devtool = "#source-map"
// config.output.filename = "[name].min.js"//"[name].[hash].min.js"
// config.output.chunkFilename = '[id].js'
config.plugins = config.plugins.concat([
// new webpack.DefinePlugin({'process.env': {NODE_ENV: JSON.stringify('production') } })
// , new webpack.NoErrorsPlugin()
])
module.exports = config