histoire-dev / histoire

⚡ Fast and beautiful interactive component playgrounds, powered by Vite
https://histoire.dev
MIT License
3.18k stars 188 forks source link

Does not work with Ionic #479

Closed huantrinh1802 closed 1 year ago

huantrinh1802 commented 1 year ago

Describe the bug

It seems to setup in typescript that causes the error but I cannot find the solution. I cannot reproduce the same error with the Stackblitz but it does throw a different error.

Error while collecting story [PATH]/src/components/Input.story.vue:
[PATH]/node_modules/@ionic/core/components/ion-accordion.js:4
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1094:15)
    at Module._compile (node:internal/modules/cjs/loader:1129:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1219:10)
    at Module.load (node:internal/modules/cjs/loader:1043:32)
    at Function.Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1067:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> ([PATTH]/node_modules/@ionic/vue/dist/index.js:6:25)

Reproduction

https://stackblitz.com/edit/histoire-vue3-starter-wwoeu5

System Info

System:
    OS: macOS 12.6.2
    CPU: (8) arm64 Apple M1
    Memory: 99.70 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.19.0 - ~/.volta/tools/image/node/16.19.0/bin/node
    Yarn: 1.22.19 - ~/.volta/bin/yarn
    npm: 6.14.18 - ~/.volta/tools/image/npm/6.14.18/bin/npm
    Watchman: 2023.03.06.00 - /opt/homebrew/bin/watchman
  Browsers:
    Chrome: 111.0.5563.64
    Firefox: 110.0.1
    Safari: 16.3
  npmPackages:
    @histoire/plugin-vue: ^0.15.8 => 0.15.8 
    @vitejs/plugin-vue: ^4.0.0 => 4.0.0 
    histoire: ^0.15.8 => 0.15.8 
    vite: ^4.1.0 => 4.1.1

Used Package Manager

npm

Validations

stackblitz[bot] commented 1 year ago

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

huantrinh1802 commented 1 year ago

Since Ionic v7 is official announced.

The removal of CommonJS resolved the issue.

Improved Vite Compatibility – We’ve removed the CommonJS entry points for Ionic React and Ionic Vue which makes Ionic easier to use with Vite and Vitest.