-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnext.config.js
90 lines (73 loc) · 2.07 KB
/
next.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
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
/** @type {import('next').NextConfig} */
const { withTamagui } = require('@tamagui/next-plugin')
const withImages = require('next-images')
const { join } = require('path')
process.env.IGNORE_TS_CONFIG_PATHS = 'true'
process.env.TAMAGUI_TARGET = 'web'
process.env.TAMAGUI_DISABLE_WARN_DYNAMIC_LOAD = '1'
const boolVals = {
true: true,
false: false,
}
const disableExtraction =
boolVals[process.env.DISABLE_EXTRACTION] ?? process.env.NODE_ENV === 'development'
console.log(`
Welcome to Tamagui!
We've set up a few things for you. Note the "excludeReactNativeWebExports" setting
in next.config.js which omits these from the bundle:
- Switch, ProgressBar, Picker, CheckBox, Touchable
Add these to save more, if you don't need them:
- AnimatedFlatList, FlatList, SectionList, VirtualizedList, VirtualizedSectionList
Even better, enable "useReactNativeWebLite" to avoid excludeReactNativeWebExports and
get tree-shaking and concurrent mode support.
🐤
You can remove this log in next.config.js.
`)
const plugins = [
withImages,
withTamagui({
config: './tamagui.config.ts',
components: ['tamagui', '@my/ui'],
importsWhitelist: ['constants.js', 'colors.js'],
logTimings: true,
disableExtraction,
// experiment - reduced bundle size react-native-web
useReactNativeWebLite: false,
shouldExtract: (path) => {
if (path.includes(join('packages', 'app'))) {
return true
}
},
excludeReactNativeWebExports: ['Switch', 'ProgressBar', 'Picker', 'CheckBox', 'Touchable'],
}),
]
module.exports = function () {
let config = {
typescript: {
ignoreBuildErrors: true,
},
images: {
disableStaticImages: true,
},
experimental: {
scrollRestoration: true,
legacyBrowsers: false,
transpilePackages: [
'solito',
'react-native-web',
'expo-linking',
'expo-constants',
'expo-modules-core',
'@my/config',
'@my/api',
],
},
}
for (const plugin of plugins) {
config = {
...config,
...plugin(config),
}
}
return config
}