init: 初始化模板项目
This commit is contained in:
27
apps/expo/metro.config.js
Normal file
27
apps/expo/metro.config.js
Normal file
@@ -0,0 +1,27 @@
|
||||
// Learn more https://docs.expo.dev/guides/monorepos
|
||||
// Learn more https://docs.expo.io/guides/customizing-metro
|
||||
/**
|
||||
* @type {import('expo/metro-config')}
|
||||
*/
|
||||
const { getDefaultConfig } = require('@expo/metro-config')
|
||||
const path = require('node:path')
|
||||
|
||||
const projectRoot = __dirname
|
||||
const workspaceRoot = path.resolve(projectRoot, '../..')
|
||||
|
||||
const config = getDefaultConfig(projectRoot)
|
||||
|
||||
// 1. Watch all files within the monorepo
|
||||
config.watchFolders = [workspaceRoot]
|
||||
// 2. Let Metro know where to resolve packages and in what order
|
||||
config.resolver.nodeModulesPaths = [
|
||||
path.resolve(projectRoot, 'node_modules'),
|
||||
path.resolve(workspaceRoot, 'node_modules'),
|
||||
]
|
||||
// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths`
|
||||
config.resolver.disableHierarchicalLookup = true
|
||||
|
||||
config.transformer = { ...config.transformer, unstable_allowRequireContext: true }
|
||||
config.transformer.minifierPath = require.resolve('metro-minify-terser')
|
||||
|
||||
module.exports = config
|
||||
Reference in New Issue
Block a user