【发布时间】:2020-11-12 11:04:18
【问题描述】:
我想用monorepo yarn workspaces 设置一个 react-native expo(空白打字稿模板)项目。我对谷歌的研究指出我使用这个库expo-yarn-workspaces。在他们网站上的教程的一个步骤中,提到您必须“创建”metro.config.js 并添加以下行:
const { createMetroConfiguration } = require('expo-yarn-workspaces');
module.exports = createMetroConfiguration(__dirname);
一般来说,在我之前的 react-native expo 项目中,我曾经在我的 metro.config.js 中添加一些自定义配置,以将我的应用程序导入 svg 文件作为 react components。这是我的自定义配置:
// metro.config.js
const { getDefaultConfig } = require("metro-config");
module.exports = (async () => {
const {
resolver: { sourceExts, assetExts }
} = await getDefaultConfig();
return {
transformer: {
babelTransformerPath: require.resolve("react-native-svg-transformer")
},
resolver: {
assetExts: assetExts.filter(ext => ext !== "svg"),
sourceExts: [...sourceExts, "svg"]
}
};
})();
我的问题是:如何进一步自定义metro.config.js 文件与自定义配置(如上)?
【问题讨论】:
标签: expo monorepo expo-yarn-workspaces