You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 1, 2020. It is now read-only.
Repository navigation
This repository was archived by the owner on May 1, 2020. It is now read-only.
Would love to see this issue fixed! Really difficult to do rapid local development on shared codebases without this. Any recommended workarounds in the meantime?
If you're developing another library that you want to link into an Ionic project, the short term work around is to just build the project and copy/paste to your local node_modules directory. It's not ideal but it's what we currently do with testing. We need to fix linking.
Alternatively, what you can do if you want it more automated, from your library you do a normal npm link and then from your application you create a symbolic link to the build folder of the library and package.json. to the linked path.
I have a script to do something similar, I am not 100% sure it works perfectly cause I had to strip out some code that is not relevant for you. But should be a good starting point.
I am setting up something similar for how we will approach Ionic apps. We have a separate project/module setup for components, etc that will be shared among multiple apps. To get this to work I am using npm link, additions to tsconfig for the share dmodule, and some a custom watch.config.js to get it to check the shared module's folder. However, the shared module is not built on an ionic serve, but is built and works fine if a file is modified to force a live reload.
Yes, adding paths to tsconfig will work. As the main issue that i had, but
with and without the appscripts that npm link, will steal dependencies,
from the linked modules. Aot will fail misrable, while in Jit you will have
issues with observables typings on custom interfaces (if you are using
them) that don't match unless you install typings.
In future, when I have some try I will definitly give the taconfig
implementation a try, as It should be a simplier solution.
On Wed, 26 Apr 2017 at 18:22, ChristopherTotty ***@***.***> wrote:
I am setting up something similar for how we will approach Ionic apps. We
have a separate project/module setup for components, etc that will be
shared among multiple apps. To get this to work I am using npm link,
additions to tsconfig for the share dmodule, and some a custom
watch.config.js to get it to check the shared module's folder. However, the
shared module is not built on an ionic serve, but is built and works fine
if a file is modified to force a live reload.
This is all based on the method described in this article:
***@***.***/sharing-logic-between-ionic2-apps-f06feaf51fad
However, I see the author has just posted an alternative solution, so I
will also explore that.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#635 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AQv-WkhjDThCgPJgLqKGObJmpLsuh0RZks5rz29ZgaJpZM4LeqPU>
.
Just finished switching over to Martin's 2nd example using tsconfig paths instead of npm link and it works great. Fixes the issue I was having with ionic serve's build requiring a forced live reload to work.
Activity
lincolnthree commentedon Apr 18, 2017
Would love to see this issue fixed! Really difficult to do rapid local development on shared codebases without this. Any recommended workarounds in the meantime?
danbucholtz commentedon Apr 21, 2017
Copy and paste the node_module lib. That's what we do with Ionic right now. I will hopefully have some time to fix this soon.
Thanks,
Dan
lincolnthree commentedon Apr 22, 2017
Hey Dan,
Thanks for responding.
Could you explain in a little more detail what you mean by copying the "node_module lib"?
Are you referring to the "node_modules" directory?
If so, copy it from where to where? Thanks!
Was this while the project was symlinked or not? Etc. Thanks!
danbucholtz commentedon Apr 23, 2017
If you're developing another library that you want to link into an Ionic project, the short term work around is to just build the project and copy/paste to your local node_modules directory. It's not ideal but it's what we currently do with testing. We need to fix linking.
Thanks,
Dan
lincolnthree commentedon Apr 23, 2017
Oh. Okay. What I've been doing is just
npm -i ../path-to-library --saveIt's not ideal for CI builds or rapid dev,since TS ngc builds can take some time, by it's working enough for us to get by.
Linking would obviously make it easier :) Thanks for keeping eyes on this.
alan-agius4 commentedon Apr 23, 2017
Alternatively, what you can do if you want it more automated, from your library you do a normal
npm linkand then from your application you create a symbolic link to thebuildfolder of the library andpackage.json. to the linked path.I have a script to do something similar, I am not 100% sure it works perfectly cause I had to strip out some code that is not relevant for you. But should be a good starting point.
Script below;
custom-link.ts.txt
to run it you can use ts-node
ChristopherTotty commentedon Apr 26, 2017
I am setting up something similar for how we will approach Ionic apps. We have a separate project/module setup for components, etc that will be shared among multiple apps. To get this to work I am using npm link, additions to tsconfig for the share dmodule, and some a custom watch.config.js to get it to check the shared module's folder. However, the shared module is not built on an ionic serve, but is built and works fine if a file is modified to force a live reload.
This is all based on the method described in this article:
https://medium.com/@blewpri/sharing-logic-between-ionic2-apps-f06feaf51fad
However, I see the author has just posted an alternative solution, so I will also explore that.
alan-agius4 commentedon Apr 26, 2017
ChristopherTotty commentedon Apr 26, 2017
Just finished switching over to Martin's 2nd example using tsconfig paths instead of npm link and it works great. Fixes the issue I was having with ionic serve's build requiring a forced live reload to work.
https://medium.com/@blewpri/sharing-code-in-angular2-ionic2-apps-simply-without-npm-5203048ec1e1
Screeze commentedon Jan 3, 2018
I am also looking forward to a solution for npm links... (See https://forum.ionicframework.com/t/share-modules-between-apps-architecture/116885/13 where I try to figure out a clean way to share modules between apps without copy & paste)
kirillgroshkov commentedon Feb 22, 2018
any updates since?
RezaRahmati commentedon Apr 19, 2018
angular has an option
ng serve --preserve-symlinksis there such a thing in Ionic?