-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.base.js
105 lines (96 loc) · 2.58 KB
/
webpack.config.base.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/**
* Base webpack config used across other specific configs
*/
import path from 'path';
import webpack from 'webpack';
import LodashModuleReplacementPlugin from 'lodash-webpack-plugin';
import del from 'del';
import { dependencies as externals } from './app/package.json';
export function deleteSourceMaps() {
del.sync(['./app/*.map', './app/dist/*.map']);
}
export default {
mode: 'development',
externals: [
...Object.keys(externals || {}),
'pg-native',
'sqlite3',
// '@falcon-client/falcon-core',
'better-sqlite3',
'pg-hstore',
'bindings'
],
module: {
// Disable handling of requires with a single expression
exprContextRegExp: /$^/,
exprContextCritical: false,
// Disable handling of requires with expression wrapped by string,
wrappedContextRegExp: /$^/,
wrappedContextCritical: false,
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: [
{
loader: 'babel-loader',
options: {
cacheDirectory: true
}
}
]
},
{
test: /\.worker\.js$/,
use: [{ loader: 'worker-loader' }]
},
{
test: /aws-sdk/,
loaders: ['transform-loader?brfs']
}
]
},
output: {
path: path.join(__dirname, 'app'),
// https://github.com/webpack/webpack/issues/1114
libraryTarget: 'commonjs2',
globalObject: 'this'
},
/**
* Determine the array of extensions that should be used to resolve modules.
*/
resolve: {
mainFields: ['module', 'main', 'browser'],
extensions: ['.mjs', '.js', '.jsx', '.json'],
modules: [path.join(__dirname, 'app'), 'node_modules'],
alias: {
'@falcon-client/graphql-voyager': path.resolve(
__dirname,
'packages/graphql-voyager'
),
'@falcon-client/react-clipboard.js': path.resolve(
__dirname,
'packages/react-clipboard.js'
),
'@falcon-client/svg-pan-zoom': path.resolve(
__dirname,
'packages/svg-pan-zoom'
),
'@falcon-client/svg-zoom': path.resolve(__dirname, 'packages/svg-zoom'),
'@falcon-client/falcon-core': path.resolve(
__dirname,
'packages/falcon-core'
),
'@falcon-client/falcon-ui': path.resolve(__dirname, 'packages/falcon-ui')
}
},
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'production'
}),
new LodashModuleReplacementPlugin(),
new webpack.NamedModulesPlugin(),
new webpack.IgnorePlugin(/^mock-firmata$/),
new webpack.ContextReplacementPlugin(/bindings$/, /^$/)
]
};