-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwings.config.js
60 lines (52 loc) · 1.2 KB
/
wings.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
const { resolve } = require('path');
const CopyPlugin = require('copy-webpack-plugin');
const setEnvironments = (configs, { webpack, wingsConfig }) => {
const { DefinePlugin } = webpack;
const env = wingsConfig.env();
const isProduction = wingsConfig.isProduction(env);
configs.plugins[0] = new DefinePlugin({
process: { env: {} },
__DEV__: !isProduction,
PUBLIC_URL: JSON.stringify(process.env.PUBLIC_URL || 'master'),
});
return configs;
};
const copyAssets = (configs) => {
configs.plugins.push(
new CopyPlugin({
patterns: [{ from: resolve(process.cwd(), 'assets/'), to: './' }],
}),
);
return configs;
};
const splitBundle = (configs) => {
configs.entry = {
app: {
...configs.entry.app,
dependOn: 'react-core',
},
'react-core': {
import: [
'react',
'react-dom',
'react-native',
'react-art',
'@react-native-async-storage/async-storage',
],
},
};
return configs;
};
module.exports = {
publicPath: () => process.env.PUBLIC_URL || '/',
keepPreviousBuild: () => true,
buildId: () => 'app',
webpackConfigs: [setEnvironments, copyAssets, splitBundle],
moduleAlias: () => {
return {
global: {
'react-native': 'react-native-web',
},
};
},
};