raphinesse commented on issue #32: Link `node_modules` during platform creation 
if it exists
URL: https://github.com/apache/cordova/issues/32#issuecomment-437362934
 
 
   From the description of this issue:
   
   > we actually _still_ need to either copy or preferably link 
`<PROJECT>/node_modules/cordova-<PLATFORM>/node_modules` to 
`<PROJECT>/platforms/<PLATFORM>/node_modules` _if the former exists_. Otherwise 
Node's module resolution would not pick up the correct dependency versions for 
the platform in case of version conflicts.
   
   The recent PRs by @erisu seem to ignore this fact. This is mandatory to not 
break module resolution. Or did you consider this and I am mistaken here? IMO, 
we need something like this in the create scripts:
   
   ```js
   // ROOT is the platform module root
   const platformDependencies = path.join(ROOT, 'node_modules');
   
   if (fs.existsSync(platformDependencies)) {
     const localPlatformDependencies = path.join(project_path, 
'cordova/node_modules');
     fs.ensureSymlinkSync(platformDependencies, localPlatformDependencies, 
'junction');
   }
   ```
   
   That should fix things until we find time to do it the right way (just my 
opinion):
   > In the long run, we should probably try to have only native projects in 
`platforms` and keep the platforms' build scripts in the project's 
`node_modules` and run them from there. That should make things easier and 
cleaner IMHO.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org
For additional commands, e-mail: commits-h...@cordova.apache.org

Reply via email to