Skip to content
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

Verify works with linked modules #635

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

Comments

@danbucholtz
Copy link
Contributor

@danbucholtz danbucholtz commented Jan 9, 2017

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

This comment has been minimized.

Copy link

@lincolnthree lincolnthree commented 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

This comment has been minimized.

Copy link
Contributor Author

@danbucholtz danbucholtz commented 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

This comment has been minimized.

Copy link

@lincolnthree lincolnthree commented 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

This comment has been minimized.

Copy link
Contributor Author

@danbucholtz danbucholtz commented 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

This comment has been minimized.

Copy link

@lincolnthree lincolnthree commented Apr 23, 2017

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

This comment has been minimized.

Copy link
Contributor

@alan-agius4 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

This comment has been minimized.

Copy link

@ChristopherTotty ChristopherTotty commented 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

This comment has been minimized.

Copy link
Contributor

@alan-agius4 alan-agius4 commented Apr 26, 2017

@ChristopherTotty

This comment has been minimized.

Copy link

@ChristopherTotty ChristopherTotty commented 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

This comment has been minimized.

Copy link

@Screeze 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

This comment has been minimized.

Copy link

@kirillgroshkov kirillgroshkov commented Feb 22, 2018

any updates since?

@RezaRahmati

This comment has been minimized.

Copy link

@RezaRahmati RezaRahmati commented Apr 19, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.