-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
61 lines (56 loc) · 1.34 KB
/
webpack.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
60
61
const path = require('path')
const webpack = require('webpack')
const nodeExternals = require('webpack-node-externals')
const projectDir = path.resolve(__dirname)
const appDir = path.join(projectDir, 'app')
const mainAppEntryPoint = path.join(appDir, 'appMain.lsc')
const ISDEV = process.env.NODE_ENV !== 'production'
const IS_BUILD_DEBUG = !!process.env.IS_BUILD_DEBUG
console.log('ISDEV: ', ISDEV)
console.log('IS_BUILD_DEBUG: ', IS_BUILD_DEBUG)
console.log('process.env.NODE_ENV: ', process.env.NODE_ENV)
const webpackOptions = {
mode: process.env.NODE_ENV,
target: 'node',
entry: mainAppEntryPoint,
output: {
filename: 'appMain-compiled.js',
path: projectDir
},
externals: [nodeExternals()],
node: {
console: false,
global: false,
process: false,
Buffer: false,
__filename: false,
__dirname: false,
setImmediate: false
},
devtool: ISDEV ? 'source-map' : 'none',
context: projectDir,
module: {
rules: [
{
test: /.lsc/,
exclude: [
/(node_modules)/
],
loader: 'babel-loader',
options: {
sourceMap: ISDEV
}
},
]
},
resolve: {
extensions: ['.lsc', '.js']
},
optimization: {
minimize: false
},
plugins: [
new webpack.DefinePlugin({ ISDEV, IS_BUILD_DEBUG }),
]
}
module.exports = webpackOptions