This repository has been archived by the owner on Dec 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
webpack.config.js_old
53 lines (44 loc) · 1.59 KB
/
webpack.config.js_old
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
const path = require('path');
const createExpoWebpackConfigAsync = require('@expo/webpack-config');
const { resolver } = require('./metro.config');
const findWorkspaceRoot = require('find-yarn-workspace-root');
// Find the workspace root, this can be replaced with `find-yarn-workspace-root`
// const workspaceRoot = path.resolve(__dirname, "../../");
const workspaceRoot = findWorkspaceRoot(__dirname);
const root = path.resolve(__dirname, '../..');
const node_modules = path.join(workspaceRoot, 'node_modules');
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv);
config.module.rules.push({
test: /\.(js|ts|tsx)$/,
include: [
path.resolve(root, 'src'),
path.join(workspaceRoot, 'node_modules/@gluestack-style/react'),
path.join(workspaceRoot, 'node_modules/@gluestack/ui'),
],
use: 'babel-loader',
});
config.module.rules.push({
test: /\.(png|jpe?g|gif)$/i,
use: [
{
loader: 'file-loader',
},
],
});
// We need to make sure that only one version is loaded for peerDependencies
// So we alias them to the versions in example's node_modules
Object.assign(config.resolve.alias, {
...resolver.extraNodeModules,
'react-native-web': path.join(node_modules, 'react-native-web'),
});
// Maybe you want to turn off compression in dev mode.
if (config.mode === 'development') {
config.devServer.compress = false;
}
// Or prevent minimizing the bundle when you build.
if (config.mode === 'production') {
config.optimization.minimize = false;
}
return config;
};