-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathwebpack.config.js
42 lines (34 loc) · 1.08 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
const createExpoWebpackConfigAsync = require('@expo/webpack-config')
module.exports = async function (env, argv) {
const config = await createExpoWebpackConfigAsync(env, argv)
// Customize the config before returning it.
// add TAMAGUI_TARGET = web to defines
const DefinePlugin = config.plugins.find((x) => x.constructor.name === 'DefinePlugin')
DefinePlugin.definitions['process.env']['TAMAGUI_TARGET'] = `"web"`
// replace babel-loader with our loaders
const rules = config.module.rules[1].oneOf
const ruleIndex = rules.findIndex((x) => x.use?.loader?.includes('babel-loader'))
rules[ruleIndex] = {
test: /\.(mjs|[jt]sx?)$/,
use: [
'thread-loader',
{
loader: require.resolve('esbuild-loader'),
options: {
loader: 'tsx',
target: 'es2019',
keepNames: true,
},
},
{
loader: require.resolve('tamagui-loader'),
options: {
config: './tamagui.config.ts',
components: ['tamagui'],
},
},
],
}
console.log('rules', rules)
return config
}