metro
metro copied to clipboard
Terrible bundler. It cannot be used in a monorepository setting
Before creating an issue please make sure you are using the latest version of Metro, try re-installing your blah blah blah.......... I do this at EVERY slightest change, because this is terribly delicate and generally unreliable.
Do you want to request a feature or report a bug? UPDATE.
What is the current behavior? Unreliable, unreliable, unreliable. Everything works just disgusting, there is no flexibility at all.
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install
and yarn test
.
I have already experienced the torment thousands of times with this "technology" of yours in a monorepository, there are already millions of crutches in the project for this simple goal.
And now I am faced with a new problem: for UNKNOWN reasons, when building an iOS Release apps, custom assets do not work.
What is the expected behavior?
Configurations which I specify in metro.config.js
should work for sure? Or do they only work when the moon is in the correct phase?
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
const { getDefaultConfig } = require("@expo/metro-config")
const blacklist = require('metro-config/src/defaults/blacklist')
const path = require('path')
module.exports = (async() => {
const defaultConfig = getDefaultConfig(__dirname)
return {
projectRoot: __dirname,
watchFolders: [
path.resolve(__dirname, "../../")
],
transformer: {
babelTransformerPath: require.resolve('react-native-svg-transformer'), // THIS IS DOESN'T WORK IN RELEASE BUILD!
assetPlugins: ['expo-asset/tools/hashAssetFiles'],
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false
}
})
},
resolver: {
assetExts: defaultConfig.resolver.assetExts.filter((ext) => ext !== 'svg'), // SVG FILES ARE ASSETS IN RELEASE
sourceExts: [...defaultConfig.resolver.sourceExts, 'svg'], // SVG FILES ARE NOT SOURCE IN RELEASE... WHY ???
extraNodeModules: {
'@xdoctor-app/shared': path.resolve(__dirname, "../shared")
},
blacklistRE: blacklist([
/ios\/Pods\/.*/,
/(.*\/android\/React(Android|Common)\/.*|.*\/versioned-react-native\/.*|node_modules\/react\/dist\/.*|website\/node_modules\/.*|heapCapture\/bundle\.js|.*\/__tests__\/.*)$/
])
},
server: {
enhanceMiddleware: (middleware) => {
return (req, res, next) => {
const assetsPath = '/shared/assets/'
const otherAssetsPath = '/node_modules/'
if (req.url.startsWith(assetsPath) && !req.url.endsWith('svg')) {
req.url = req.url.replace(assetsPath, '/assets/../shared/assets/')
}
if (req.url.startsWith(otherAssetsPath) && !req.url.endsWith('svg')) {
req.url = req.url.replace(otherAssetsPath, '/assets/../../node_modules/')
}
return middleware(req, res, next)
}
}
}
}
})()
My colleagues and I are also extremely disappointed with how Facebook treats its open source projects. They do not sponsor enough - problems are not handled at all, or it takes a very long time to wait for even an answer. Many things are not described in the documentation. And project management is not fully outsourced to the community. It's sad.
Almost every day I have to deal with the inoperability of their code :(
Thinking to try just released react-native-webpack-toolkit instead metro.