spacedrive/apps/mobile/metro.config.js
Oscar Beaumont c7441d1d64
Rustify mobile (#361)
* Refactor navigation flow & types

* Remove drawer screen wrapper

* Remove DrawerItem + cleanup

* Switch to JS Stack Nav & header animations

* [WIP] Spacedrive core on Android & IOS

* Update Podfile and cleanup Contributing guide.

* Remove @sd/core from mobile

* File Modal

* Prettify File Modal & Add date-fns

* IOS subscriptions

* Update package versions

* Custom header for stack screens

* android subscriptions

* Animate Drawer button & template for Search screen

* Search header

* Fix Search icon being weird

* Merge branch 'main' into rustify-mobile

* fix rspc dep + setup script for mobile

* Less margin on header

* Move shared assets & drawer logo for mobile

* support for IOS simulator

* add type safe rspc hooks to mobile

* Cleanup PR & Update packages

* Updated bindings from main

* Update lefthook.yml

* Remove `tag` folder from core
The `tag` folder came back from the dead. Maybe it got confused in merge conflict?

* update pnpm lockfile + fix tsc errors

* fix asset import

Co-authored-by: Utku Bakir <74243531+utkubakir@users.noreply.github.com>
2022-08-29 04:59:09 -07:00

62 lines
1.8 KiB
JavaScript

const { makeMetroConfig, resolveUniqueModule, exclusionList } = require('@rnx-kit/metro-config');
const MetroSymlinksResolver = require('@rnx-kit/metro-resolver-symlinks');
// Might not need these anymore.
const [SDAssetsPath, SDAssetsPathExclude] = resolveUniqueModule('@sd/assets', '.');
const [babelRuntimePath, babelRuntimeExclude] = resolveUniqueModule('@babel/runtime');
const [reactPath, reactExclude] = resolveUniqueModule('react');
// 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 metroConfig = makeMetroConfig({
projectRoot: __dirname,
resolver: {
...expoDefaultConfig.resolver,
resolveRequest: MetroSymlinksResolver(),
extraNodeModules: {
'@babel/runtime': babelRuntimePath,
'@sd/assets': SDAssetsPath,
'react': reactPath,
'react-native-svg': reactSVGPath
},
blockList: exclusionList([
babelRuntimeExclude,
SDAssetsPathExclude,
reactExclude,
reactSVGExclude
]),
sourceExts: [...expoDefaultConfig.resolver.sourceExts, 'svg'],
assetExts: expoDefaultConfig.resolver.assetExts.filter((ext) => ext !== 'svg')
},
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;