status-web-archive/apps/next/next.config.js

79 lines
1.7 KiB
JavaScript
Raw Normal View History

2023-01-10 11:25:26 +00:00
/** @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,
2023-01-11 13:38:47 +00:00
false: false,
2023-01-10 11:25:26 +00:00
}
const disableExtraction =
boolVals[process.env.DISABLE_EXTRACTION] ??
process.env.NODE_ENV === 'development'
const plugins = [
// withImages,
withTamagui({
config: './tamagui.config.ts',
2023-01-16 12:08:24 +00:00
components: ['@status-im/components'],
2023-01-10 11:25:26 +00:00
importsWhitelist: ['constants.js', 'colors.js'],
logTimings: true,
2023-01-16 12:08:24 +00:00
disableExtraction: true,
2023-01-11 13:38:47 +00:00
2023-01-10 11:25:26 +00:00
// experiment - reduced bundle size react-native-web
useReactNativeWebLite: false,
shouldExtract: path => {
if (path.includes(join('packages', 'app'))) {
return true
}
},
excludeReactNativeWebExports: [
2023-01-16 12:08:24 +00:00
// 'Switch',
// 'ProgressBar',
// 'Picker',
// 'CheckBox',
// 'Touchable'
2023-01-11 13:38:47 +00:00
],
}),
2023-01-10 11:25:26 +00:00
]
2023-01-11 13:38:47 +00:00
module.exports = function () {
2023-01-10 11:25:26 +00:00
/** @type {import('next').NextConfig} */
let config = {
typescript: {
2023-01-11 13:38:47 +00:00
ignoreBuildErrors: true,
2023-01-10 11:25:26 +00:00
},
images: {
2023-01-11 13:38:47 +00:00
disableStaticImages: true,
2023-01-10 11:25:26 +00:00
},
transpilePackages: [
// 'solito',
2023-01-16 12:08:24 +00:00
'react-native-web',
2023-01-10 11:25:26 +00:00
// 'expo-linking',
// 'expo-constants',
// 'expo-modules-core'
2023-01-11 13:38:47 +00:00
'@status-im/components',
2023-01-10 11:25:26 +00:00
],
2023-01-11 13:38:47 +00:00
2023-01-10 11:25:26 +00:00
experimental: {
// optimizeCss: true,
// scrollRestoration: true,
2023-01-11 13:38:47 +00:00
legacyBrowsers: false,
},
2023-01-10 11:25:26 +00:00
}
for (const plugin of plugins) {
config = {
...config,
2023-01-11 13:38:47 +00:00
...plugin(config),
2023-01-10 11:25:26 +00:00
}
}
return config
}