-
Notifications
You must be signed in to change notification settings - Fork 626
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Haste has troubles resolving modules inside @scoped modules #241
Comments
cc @rafeca @mjesun and rest of Metro folks: @empyrical is one of our core contributors over at React Native. |
Thanks for the really good repro steps!! 😃 I'll look at this later on the week |
No problem! 😄 I also just tested, and it has issues with Windows - while top-level JS was able to find it('should work with scoped providesModuleNodeModules (haste, win32)', async () => {
var root = 'C:\\root';
setMockFileSystem({
root: {
'index.js': `
/**
* @providesModule index
*/
require('shouldWork');
require('Bar');
`,
node_modules: {
'react-haste': {
'package.json': JSON.stringify({
name: 'react-haste',
main: 'main.js',
}),
'main.js': [
'/**',
' * @providesModule shouldWork',
' */',
].join('\n'),
},
'@org': {
module: {
'package.json': JSON.stringify({
name: '@org/module',
main: 'main.js',
}),
'main.js': '// Blank',
'Bar.js': `
/**
* @providesModule Bar
*/
require('shouldWork');
`,
},
},
},
},
});
const opts = {
...defaults,
providesModuleNodeModules: [...defaults.providesModuleNodeModules, '@org/module'],
watchFolders: [root],
};
await processDgraph(opts, async dgraph => {
const deps = await getOrderedDependenciesAsJSON(
dgraph,
'C:\\root\\index.js',
);
console.error(deps)
expect(deps).toMatchSnapshot();
});
}); Which fails with this:
|
Summary: This PR gives RNPM the ability to look for plugins in `scoped` modules. The regexes for finding RNPM plugins will match these hypothetical examples: * `rnpm-plugin-foo` * `org/rnpm-plugin-foo` The regexes for finding React Native plugins will match these hypothetical examples: * `react-native-foo` * `org/react-native-foo` * `The controller you requested could not be found./module` (will be useful in the slimmening) * `The controller you requested could not be found./module` RNPM plugins will be able to benefit from this immediately, but React Native plugins will run into this Metro issue currently: facebook/metro#241 Pull Request resolved: #21082 Differential Revision: D9809094 Pulled By: hramos fbshipit-source-id: 4b0694ad4119b37dd5664af52c48e48ebe4d7404
…ook#21082) Summary: This PR gives RNPM the ability to look for plugins in `scoped` modules. The regexes for finding RNPM plugins will match these hypothetical examples: * `rnpm-plugin-foo` * `org/rnpm-plugin-foo` The regexes for finding React Native plugins will match these hypothetical examples: * `react-native-foo` * `org/react-native-foo` * `The controller you requested could not be found./module` (will be useful in the slimmening) * `The controller you requested could not be found./module` RNPM plugins will be able to benefit from this immediately, but React Native plugins will run into this Metro issue currently: facebook/metro#241 Pull Request resolved: facebook#21082 Differential Revision: D9809094 Pulled By: hramos fbshipit-source-id: 4b0694ad4119b37dd5664af52c48e48ebe4d7404
Summary: This PR gives RNPM the ability to look for plugins in `scoped` modules. The regexes for finding RNPM plugins will match these hypothetical examples: * `rnpm-plugin-foo` * `org/rnpm-plugin-foo` The regexes for finding React Native plugins will match these hypothetical examples: * `react-native-foo` * `org/react-native-foo` * `The controller you requested could not be found./module` (will be useful in the slimmening) * `The controller you requested could not be found./module` RNPM plugins will be able to benefit from this immediately, but React Native plugins will run into this Metro issue currently: facebook/metro#241 Pull Request resolved: #21082 Differential Revision: D9809094 Pulled By: hramos fbshipit-source-id: 4b0694ad4119b37dd5664af52c48e48ebe4d7404
Summary: This PR gives RNPM the ability to look for plugins in `scoped` modules. The regexes for finding RNPM plugins will match these hypothetical examples: * `rnpm-plugin-foo` * `org/rnpm-plugin-foo` The regexes for finding React Native plugins will match these hypothetical examples: * `react-native-foo` * `org/react-native-foo` * `The controller you requested could not be found./module` (will be useful in the slimmening) * `The controller you requested could not be found./module` RNPM plugins will be able to benefit from this immediately, but React Native plugins will run into this Metro issue currently: facebook/metro#241 Pull Request resolved: facebook/react-native#21082 Differential Revision: D9809094 Pulled By: hramos fbshipit-source-id: 4b0694ad4119b37dd5664af52c48e48ebe4d7404
…ook#21082) Summary: This PR gives RNPM the ability to look for plugins in `scoped` modules. The regexes for finding RNPM plugins will match these hypothetical examples: * `rnpm-plugin-foo` * `org/rnpm-plugin-foo` The regexes for finding React Native plugins will match these hypothetical examples: * `react-native-foo` * `org/react-native-foo` * `The controller you requested could not be found./module` (will be useful in the slimmening) * `The controller you requested could not be found./module` RNPM plugins will be able to benefit from this immediately, but React Native plugins will run into this Metro issue currently: facebook/metro#241 Pull Request resolved: facebook#21082 Differential Revision: D9809094 Pulled By: hramos fbshipit-source-id: 4b0694ad4119b37dd5664af52c48e48ebe4d7404
Do you want to request a feature or report a bug?
Report a bug.
What is the current behavior?
If you are outside of a
@scoped/module
, you can properlyrequire()
a haste module that is sitting inside@scoped/module
But if a JS file inside of
@scoped/module
tries to include a haste module, it's unable to resolve it.What is the expected behavior?
Metro should be able to properly resolve Haste modules from inside scoped modules
Metro version:
0.45.1
Node version:
10.5.0
I am attempting to fix this, but haven't gotten anywhere yet. I've made a Jest test that goes inside
traverseDependencies-integration-test.js
to test against:Which fails with this error:
The text was updated successfully, but these errors were encountered: