Giter Site home page Giter Site logo

Comments (11)

simonhaenisch avatar simonhaenisch commented on May 20, 2024 2

Just found a solution to get around this... you can add a path mapping for @ionic/core to tsconfig.json so that it resolves @ionic/core to the same path for both your project and @ionic/pwa-elements:

{
  "compilerOptions": {
    // ...

    "baseUrl": ".", // needed to make "paths" work
    "paths": {
      "@ionic/core": ["node_modules/@ionic/core"]
    }
  }
}

I have a suggestion for a better and cleaner solution though, that would be a bit of a breaking change but solve this long-term: make Ionic an external dependency. That would mean that when including @ionic/pwa-elements as a script, @ionic/core would have to be included first. When using it in a project, @ionic/core should be a peer dependency. Because of how Ionic components are lazy-loaded, I think this approach would work fine. If agreed, I can try and make a PR for that (/cc @mlynch @mhartington)?

from pwa-elements.

mlynch avatar mlynch commented on May 20, 2024 2

Hey all, we're working on some changes that should permanently fix this. Stay tuned.

from pwa-elements.

SoftronetBithin avatar SoftronetBithin commented on May 20, 2024 1

Just found a solution to get around this... you can add a path mapping for @ionic/core to tsconfig.json so that it resolves @ionic/core to the same path for both your project and @ionic/pwa-elements:

{
  "compilerOptions": {
    // ...

    "baseUrl": ".", // needed to make "paths" work
    "paths": {
      "@ionic/core": ["node_modules/@ionic/core"]
    }
  }
}

I have a suggestion for a better and cleaner solution though, that would be a bit of a breaking change but solve this long-term: make Ionic an external dependency. That would mean that when including @ionic/pwa-elements as a script, @ionic/core would have to be included first. When using it in a project, @ionic/core should be a peer dependency. Because of how Ionic components are lazy-loaded, I think this approach would work fine. If agreed, I can try and make a PR for that (/cc @mlynch @mhartington)?

Thanks @simonhaenisch . It works for me.

from pwa-elements.

mlynch avatar mlynch commented on May 20, 2024 1

@simonhaenisch we do want to get back to that point, and it should work. Just given everyone's time it wasn't going to work before we hit 1.0 so we needed to punt on that. There's some compiler work still to be done first.

from pwa-elements.

MCanhisares avatar MCanhisares commented on May 20, 2024

Do we have an update on this?

from pwa-elements.

jase88 avatar jase88 commented on May 20, 2024

Workaround for us was to use selective dependency resolutions with yarn

package.json
"resolutions": { "@ionic/core": "4.3.0" },

from pwa-elements.

corysmc avatar corysmc commented on May 20, 2024

Ran into this issue today as well.

from pwa-elements.

corysmc avatar corysmc commented on May 20, 2024

Thanks @simonhaenisch that fixes it for me!

from pwa-elements.

mlynch avatar mlynch commented on May 20, 2024

Does changing this to use peerDependencies resolve it?

from pwa-elements.

simonhaenisch avatar simonhaenisch commented on May 20, 2024

Just saw that you removed Ionic completely... that's another way of making it work 😄 I liked the idea of it being an extension of Ionic (i. e. it would be able to use ion-toast), however there doesn't seem to be a simple way of maintaining that.

from pwa-elements.

jcesarmobile avatar jcesarmobile commented on May 20, 2024

as 1.1.0 doesn't use @ionic/core, this can be closed

from pwa-elements.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.