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

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

Closed
4 of 6 tasks
riderx opened this issue Aug 26, 2021 · 16 comments · Fixed by #25381
Closed
4 of 6 tasks

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

riderx opened this issue Aug 26, 2021 · 16 comments · Fixed by #25381
Labels
package: core @ionic/core package type: bug a confirmed bug report v6 issues specific to Framework v6

Comments

@riderx
Copy link

riderx commented Aug 26, 2021

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 : #23671 (comment)

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

@ionitron-bot ionitron-bot bot added the triage label Aug 26, 2021
@riderx riderx changed the title bug: @ionic/vue@next dynamic import error bug: vite @ionic/vue@next dynamic import error Aug 26, 2021
@riderx riderx changed the title bug: vite @ionic/vue@next dynamic import error bug: vite vue 3 @ionic/vue@next dynamic import error Aug 26, 2021
@riderx
Copy link
Author

riderx commented Aug 26, 2021

@aaronksaunders

@liamdebeasi
Copy link
Contributor

Thanks for the issue. Is this preventing your app from compiling, or is it a warning in the console?

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Aug 26, 2021
@ionitron-bot ionitron-bot bot removed the triage label Aug 26, 2021
@riderx
Copy link
Author

riderx commented Aug 27, 2021

It compile but the rendering is broken and that the only issue I see :
Screenshot 2021-08-27 at 18 44 39

https://github.com/Forgr-ee/Mimesis/tree/vite on the vite branch it's broken
on the current branch https://github.com/Forgr-ee/Mimesis/commits/old_firebase with webpack no issue

here the commit with the changes :
Forgr-ee/Mimesis@96df4f5

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Aug 27, 2021
@liamdebeasi
Copy link
Contributor

Thanks! Could you please clarify the steps to reproduce the issue? I am unable to get the warning described in #23823 (comment), and npm install fails on the reproduction provided in #23823 (comment) due to missing/corrupt dependencies.

@liamdebeasi liamdebeasi added the needs: reply the issue needs a response from the user label Aug 27, 2021
@ionitron-bot ionitron-bot bot removed the triage label Aug 27, 2021
@riderx riderx changed the title bug: vite vue 3 @ionic/vue@next dynamic import error bug: vite vue 3 @ionic/vue@next dynamic import warning Aug 29, 2021
@riderx
Copy link
Author

riderx commented Aug 29, 2021

@iampersistent I'm sorry for #23823 (comment) this was not from ionic.
it was missing in my project postcss.config.js for tailwind, it was the issue who broke the design.

The only issue is the warning in the console. everything works

@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Aug 29, 2021
@liamdebeasi
Copy link
Contributor

Thanks I can reproduce this. Looks like it's importing some left over Stencil lazy-loading code. Since this is a warning, you should be fine to ignore it for now.

@liamdebeasi liamdebeasi changed the title bug: vite vue 3 @ionic/vue@next dynamic import warning bug: v6, custom elements, vite including old stencil lazy loading code Sep 1, 2021
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels Sep 1, 2021
@liamdebeasi liamdebeasi added this to the 6.0.0 milestone Sep 1, 2021
@ionitron-bot ionitron-bot bot removed the triage label Sep 1, 2021
@liamdebeasi liamdebeasi added the v6 issues specific to Framework v6 label Sep 8, 2021
@piotr-cz
Copy link

piotr-cz commented Nov 5, 2021

There is a similar issue for stencil (ionic-team/stencil#3118) and possible fix (ionic-team/stencil#2959) with more details about the context.
App is being build fine, just the warning in watch mode is a bit annoying.

To reproduce:

  1. clone https://github.com/piotr-cz/ionic-framework-bug-23516
  2. npm install
  3. npm start

@reslear
Copy link

reslear commented Nov 17, 2021

same, any news to hide?

@liamdebeasi liamdebeasi removed this from the 6.0.0 milestone Nov 23, 2021
@johannschopplich
Copy link

Pretty keen on an update for this issue myself in 2022. 🙂

@axsann
Copy link

axsann commented 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

@realityfilter
Copy link

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

@riderx
Copy link
Author

riderx commented May 31, 2022

Seems the necessary change have been made into stencil!
Next step updates the dependency in ionic and release.
When seeing the change it looks it was more that just adding ignore somewhere.
Also while reading the doc it seems it could increase the bundle size: https://stenciljs.com/docs/config-extras#experimentalimportinjection

@liamdebeasi
Copy link
Contributor

The bundle size increase should only apply to the dist output target. If you are using Ionic Vue v6 or Ionic React v6, then you are using the dist-custom-elements output target.

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved in updates to both Stencil and Ionicons. An upcoming version of Ionic will force the installed versions of Ionicons and Stencil to update, but you can receive this fix now by reinstalling your Ionic dependencies.

To receive this fix, please make sure you are running @ionic/vue or @ionic/react v6.1.7 or newer as well as ionicons 6.0.2 or newer.

You may need to remove your node_modules or your package-lock.json and run a fresh npm install.

@piotr-cz
Copy link

piotr-cz commented Jun 1, 2022

After update to @ionic/react v6.1.7 the built vendor.[hash].js file decreased from 807KB to 792KB, the [vite] warning is gone too.

@ionitron-bot
Copy link

ionitron-bot bot commented Jul 1, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Jul 1, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report v6 issues specific to Framework v6
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants