This repository was archived by the owner on Oct 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathwebpack.config.base.js
More file actions
78 lines (73 loc) · 1.52 KB
/
webpack.config.base.js
File metadata and controls
78 lines (73 loc) · 1.52 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
const path = require('path');
const webpack = require('webpack');
const webpackMerge = require('webpack-merge');
const srcPath = path.join(__dirname, 'src');
const baseConfig = {
entry: [path.join(srcPath, 'index.js')],
output: {
path: path.join(__dirname, 'lib'),
libraryTarget: 'umd',
library: 'AtlasSDK',
umdNamedDefine: true
},
resolve: {
extensions: ['.js'],
alias: {
models: path.join(srcPath, 'models')
}
},
module: {
rules: [
{
test: /\.(js)$/,
include: srcPath,
exclude: /node_modules/,
enforce: 'pre',
use: [
{
loader: 'eslint-loader'
}
]
},
{
test: /\.(js)$/,
include: srcPath,
use: {
loader: 'babel-loader',
options: {
presets: ['env'],
plugins: ['add-module-exports', 'transform-es2015-modules-umd']
}
}
},
{
test: /\.json$/,
use: {
loader: 'json-loader'
}
}
]
},
devtool: 'module-source-map',
plugins: [
new webpack.NormalModuleReplacementPlugin(/iconv-loader$/, 'node-noop')
]
};
const clientBaseConfig = webpackMerge(baseConfig, {
target: 'web',
output: {
filename: 'index.js'
},
node: {
net: 'empty',
tls: 'empty',
dns: 'empty'
}
});
const nodeBaseConfig = webpackMerge(baseConfig, {
target: 'node',
output: {
filename: 'index.node.js'
}
});
module.exports = { clientBaseConfig, nodeBaseConfig };