Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Verify works with linked modules #635

Open
danbucholtz opened this issue Jan 9, 2017 · 12 comments
Open

Verify works with linked modules #635

danbucholtz opened this issue Jan 9, 2017 · 12 comments
Assignees

Comments

@danbucholtz
Copy link
Contributor

Verify everything plays nicely with npm linked modules.

  1. Create an app
  2. Build Ionic or some other module, link it in
  3. Run ionic serve and verify that app-scripts handles the sym links correctly

Thanks,
Dan

@lincolnthree
Copy link

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
Copy link
Contributor Author

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
Copy link

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
Copy link
Contributor Author

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
Copy link

Oh. Okay. What I've been doing is just npm -i ../path-to-library --save

It'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
Copy link
Contributor

alan-agius4 commented Apr 23, 2017

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.

Script below;
custom-link.ts.txt

to run it you can use ts-node

@ChristopherTotty
Copy link

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
Copy link
Contributor

alan-agius4 commented Apr 26, 2017 via email

@ChristopherTotty
Copy link

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
Copy link

Screeze commented 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
Copy link

any updates since?

@RezaRahmati
Copy link

angular has an option ng serve --preserve-symlinks is there such a thing in Ionic?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants