react-native-monorepo-config 0.2.2 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +6 -12
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -135,16 +135,10 @@ export function withMetroConfig(baseConfig, { root, dirname, workspaces }) {
|
|
|
135
135
|
|
|
136
136
|
// We need to exclude the peerDependencies we've collected in packages' node_modules
|
|
137
137
|
// Otherwise duplicate versions of the same package will be loaded
|
|
138
|
-
const blockList =
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
peers.map(
|
|
143
|
-
(m) => `^${escape(path.join(dir, 'node_modules', m))}\\/.*$`
|
|
144
|
-
)
|
|
145
|
-
)
|
|
146
|
-
.join('|') +
|
|
147
|
-
')$'
|
|
138
|
+
const blockList = Object.values(packages).flatMap((dir) =>
|
|
139
|
+
peers.map(
|
|
140
|
+
(m) => new RegExp(`^${escape(path.join(dir, 'node_modules', m))}[\/\\\\]`)
|
|
141
|
+
)
|
|
148
142
|
);
|
|
149
143
|
|
|
150
144
|
// When we import a package from the monorepo, metro may not be able to find the deps in blockList
|
|
@@ -185,8 +179,8 @@ export function withMetroConfig(baseConfig, { root, dirname, workspaces }) {
|
|
|
185
179
|
resolveRequest: (originalContext, moduleName, platform) => {
|
|
186
180
|
let context = originalContext;
|
|
187
181
|
|
|
188
|
-
// Prefer the source field for monorepo packages to consume source code
|
|
189
|
-
if (packages
|
|
182
|
+
// Prefer the source field for monorepo packages and their subpaths to consume source code
|
|
183
|
+
if (Object.keys(packages).some((name) => moduleName.startsWith(name))) {
|
|
190
184
|
context = {
|
|
191
185
|
...context,
|
|
192
186
|
mainFields: ['source', ...context.mainFields],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-monorepo-config",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Configure Metro for a React Native app in a monorepo",
|
|
5
5
|
"repository": "https://github.com/satya164/react-native-monorepo-config",
|
|
6
6
|
"author": "Satyajit Sahoo <satyajit.happy@gmail.com> (https://github.com/satya164/)",
|