question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: v6, custom elements, vite including old stencil lazy loading code

See original GitHub issue

Prequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

when trying to create fresh project with vite and ionic 6 beta i got this :

1827|      return module[exportName];
1828|    }
1829|    return import(
   |                  ^
1830|      /* webpackInclude: /\.entry\.js$/ */
1831|      /* webpackExclude: /\.system\.entry\.js$/ */
The above dynamic import cannot be analyzed by vite.
See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.

  Plugin: vite:import-analysis

Expected Behavior

Since you said it work only for vue here : https://github.com/ionic-team/ionic-framework/issues/23671#issuecomment-884890552

i give a try like we can read here : https://dev.to/aaronksaunders/getting-started-with-vitejs-ionic-framework-beta-v6-and-vuejs-2o8l and this https://github.com/riderx/ionicv6-beta-vue-vite doesn’t work in my end

Steps to Reproduce

you can clone this : https://github.com/riderx/ionicv6-beta-vue-vite and do npm i then npm run dev with node 16

Code Reproduction URL

https://github.com/riderx/ionicv6-beta-vue-vite

Ionic Info

Ionic:

   Ionic CLI : 6.17.0

Utility:

   cordova-res (update available: 0.15.3) : 0.15.2
   native-run                             : 1.4.0

System:

   NodeJS : v16.7.0
   npm    : 7.20.3
   OS     : macOS Monterey

Additional Information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

7reactions
realityfiltercommented, Feb 23, 2022

+1 for official /* @vite-ignore */

5reactions
axsanncommented, Jan 29, 2022

You can avoid this warning using patch-package.

$ yarn add -D patch-package

package.json

  "scripts": {
    ......
    "postinstall": "patch-package"
  },

Edit node_modules/@stencil/core/internal/client/index.js. Add /* @vite-ignore */.

    return import(
    /* @vite-ignore */
    /* webpackInclude: /\.entry\.js$/ */
    /* webpackExclude: /\.system\.entry\.js$/ */
    /* webpackMode: "lazy" */

Create patch and re-install.

$ yarn patch-package @stencil/core
$ rm -rf ./node_modules
$ yarn
Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Elements - Stencil.js
The dist-custom-elements builds each component as a stand-alone class that extends HTMLElement . The output is a standardized custom element with the styles ......
Read more >
Lazy-load React components in Remix by sergiodxa
Suppose we want to create a timeline component that lists different events. Each event type has a unique com... Published on sergiodxa.com.
Read more >
Unable to load stencil components lib with Vue3 using Vite
It appears that node_modules/. vite is the directory where Vite's dependency pre-bundling feature caches things.
Read more >
Ionic v6 beta release - Mastering Ionic
Ionic Framework v6 will ship with what is being termed a Custom Elements Build. This simply refers to not using Stencil's lazy loading...
Read more >
@ionic/core | Yarn - Package Manager
... fast, top-quality cross-platform native and Progressive Web Apps from a single codebase with JavaScript and the Web. Ionic is based on Web...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found