-
-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathnext.config.js
80 lines (74 loc) · 1.92 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
const { withTamagui } = require('@tamagui/next-plugin')
const { join } = require('path')
const withTM = require('next-transpile-modules') // pass the modules you would like to see transpiled
const { i18n } = require('./next-i18next.config')
const boolVals = {
true: true,
false: false,
}
const disableExtraction =
boolVals[process.env.DISABLE_EXTRACTION] ?? process.env.NODE_ENV === 'development'
if (disableExtraction) {
console.log('Disabling static extraction in development mode for better HMR')
}
const extrasPlugins = [
'@tamagui-extras/config',
'@tamagui-extras/core',
'@tamagui-extras/date',
'@tamagui-extras/file',
'@tamagui-extras/form',
'@tamagui-extras/link',
'@tamagui-extras/rich-text',
'@tamagui-extras/video',
'@tamagui-extras/youtube',
]
const transpilePackages = [
'solito',
'react-native-web',
'react-native',
'expo-linking',
'expo-constants',
'expo-modules-core',
'expo-document-picker',
'expo-av',
...extrasPlugins,
// '@expo/vector-icons',
]
const plugins = [
withTM(transpilePackages),
withTamagui({
config: './tamagui.config.ts',
components: ['tamagui', ...extrasPlugins],
importsWhitelist: ['constants.js', 'colors.js'],
outputCSS: process.env.NODE_ENV === 'production' ? './public/tamagui.css' : null,
logTimings: true,
disableExtraction,
shouldExtract: (path) => {
if (path.includes(join('packages', 'app'))) {
return true
}
},
excludeReactNativeWebExports: ['Switch', 'ProgressBar', 'Picker', 'CheckBox', 'Touchable'],
}),
]
module.exports = function () {
/** @type {import('next').NextConfig} */
let config = {
i18n,
typescript: {
ignoreBuildErrors: true,
},
images: {},
transpilePackages: transpilePackages,
experimental: {
scrollRestoration: true,
},
}
for (const plugin of plugins) {
config = {
...config,
...plugin(config),
}
}
return config
}