-
-
Notifications
You must be signed in to change notification settings - Fork 35
Description
I'm submitting a bug report
- Library Version:
3.0.0-rc.1
Please tell us about your environment:
-
Operating System:
Windows 10 -
Node Version:
6.11.2 | 8.10.0
- NPM Version:
3.10.10 | 5.6.0
- JSPM OR Webpack AND Version
webpack 4.5.0
-
Browser:
Chrome 65.0.3325.181 | Firefox 59.0.2 | Edge 41.16299.371.0 -
Language:
TypeScript 2.8.1
Current behavior:
The plugin is not working as expected when packages are symlinked. To demonstrate the behavior, I have created a repository. I have a monorepo (using lerna) with following structure:
|-modules
| |-main // aurelia-webpack project
| |-myplugin // aurelia plugin as npm module
| |-services // an npm module containing services
|-package.json // contains npm scripts using lerna to build app
If I want to register some module specific routes from myplugin, I need to use
{ moduleId: PLATFORM.moduleName("./views/plugin-home"), route: "myplugin" }With this, the webpack build for main works iff I set resolve.symlinks: false in my webpack config. However, this causes another problem which portrays as if the DI is failing. To clarify, let's assume that there is a MyService exported from services package, which is used in both main/main.ts and myplugin/index.ts with Container.instance.get. Now, one would expect that same instance will be provided in both the places. However, that is not the case as MyService is being resolved from 2 different sources:
- For
main/main.ts: frommain/node_modules/services/... - For
myplugin/index.ts: frommain/node_modules/myplugin/node_modules/services/...(as compiled frommain)
And this problem can only be resolved usingresolve.symlinks: true, which provides unique path for both cases. One can verify using the provided repository and tweaking the configurations.
Expected/desired behavior:
-
What is the expected behavior?
The expected behavior is that one configuration should support both the cases. Also if possible, please add documentation/best practices for monorepo. -
What is the motivation / use case for changing the behavior?
In a monorepo application one would ideally like to symlink the local dependencies, so that a simplewatchtask to build the sources, makes the changes immediately available for the running application.