spacedrive/apps/mobile/metro.config.js
Utku 76e3d0b9a2
Mobile - File Import (#443)
* Fix File modal and Stats

* Add disabled and loading state for dialog

* Close library drowdown with drawer

* catch Rust panics on mobile to prevent UB

* Update packages

* Move create lib dialog to container

* Create library on onboarding

* Cleanup metro config & update packages

* onClose for Dialog & update library cache

* Fix pods, downgrade react-native-svg

* Fix lib switching, organization, start import modal

* Add device size info

* Revert merge + version upgrade/fix

* Create Location & Remove placeholder data

* Create default modal component

* Check if the location already exists

* Add media-library + prettier

* fix build

* Fix Xcode shellScript too

* More small fixes

* don't export bindings on mobile devices

* Explorer store + cleanup

* Explorer comp. & add flashlist

* [WIP] Files in Locations & new file thumb

* clean merge

* Fix imports

* Fix core on mobile

* Add platform context to mobile

* Refactor libraryStore

* Add thumb url path to platform context

* Try fixing app startup

* Add zip and video to filethumb

* Delete bindings.ts from mobile

* Remove heroicons from mobile too

* useForwardedRef hook

* Media Library permission stuff

* Clean import modal

* remove valtio-persist from @sd/client

* prevent Sentry capturing all events

* refactor `@sd/client` to make it better for mobile

* fix mobile splashscreen
Just trust me bro

* fix mobile draw active style

* use custom valtioPersist for current library state

* remove mobile lockfile
It's now in the pnpm workspace so it shared the main one.

* finally remove valtio-persist

* remove 'mobile' from Platform as it's in interface

Co-authored-by: Oscar Beaumont <oscar@otbeaumont.me>
2022-11-01 21:32:56 +08:00

57 lines
1.6 KiB
JavaScript

const { makeMetroConfig, resolveUniqueModule, exclusionList } = require('@rnx-kit/metro-config');
const path = require('path');
// Needed for transforming svgs from @sd/assets
const [reactSVGPath, reactSVGExclude] = resolveUniqueModule('react-native-svg');
const { getDefaultConfig } = require('expo/metro-config');
const expoDefaultConfig = getDefaultConfig(__dirname);
const projectRoot = __dirname;
const workspaceRoot = path.resolve(projectRoot, '../..');
const metroConfig = makeMetroConfig({
projectRoot,
watchFolders: [workspaceRoot],
resolver: {
...expoDefaultConfig.resolver,
extraNodeModules: {
'react-native-svg': reactSVGPath
},
blockList: exclusionList([reactSVGExclude]),
sourceExts: [...expoDefaultConfig.resolver.sourceExts, 'svg'],
assetExts: expoDefaultConfig.resolver.assetExts.filter((ext) => ext !== 'svg'),
disableHierarchicalLookup: true,
nodeModulesPaths: [
path.resolve(projectRoot, 'node_modules'),
path.resolve(workspaceRoot, 'node_modules')
]
},
transformer: {
// Metro default is "uglify-es" but terser should be faster and has better defaults.
minifierPath: 'metro-minify-terser',
minifierConfig: {
compress: {
drop_console: true,
// Sometimes improves performance?
reduce_funcs: false
},
format: {
ascii_only: true,
wrap_iife: true,
quote_style: 3
}
},
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true
}
}),
babelTransformerPath: require.resolve('react-native-svg-transformer')
}
});
module.exports = metroConfig;