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

Verify works with linked modules #635

Open

Description

@danbucholtz

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

Activity

  1. self-assigned this
    on Jan 9, 2017
  2. lincolnthree commented on Apr 18, 2017

    @lincolnthree

    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?

  3. danbucholtz commented on Apr 21, 2017

    @danbucholtz
    ContributorAuthor

    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

  4. lincolnthree commented on Apr 22, 2017

    @lincolnthree

    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!

  5. danbucholtz commented on Apr 23, 2017

    @danbucholtz
    ContributorAuthor

    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

  6. lincolnthree commented on Apr 23, 2017

    @lincolnthree

    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.

  7. alan-agius4 commented on Apr 23, 2017

    @alan-agius4
    Contributor

    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

  8. ChristopherTotty commented on Apr 26, 2017

    @ChristopherTotty

    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.

  9. alan-agius4 commented on Apr 26, 2017

    @alan-agius4
    Contributor
  10. ChristopherTotty commented on Apr 26, 2017

    @ChristopherTotty

    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

  11. Screeze commented on Jan 3, 2018

    @Screeze

    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)

  12. kirillgroshkov commented on Feb 22, 2018

    @kirillgroshkov

    any updates since?

  13. RezaRahmati commented on Apr 19, 2018

    @RezaRahmati

    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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions