Menci / vite-plugin-top-level-await

Transform code to support top-level await in normal browsers for Vite.
MIT License
266 stars 15 forks source link

[vite-plugin-top-level-await] missing field `ctxt` #52

Closed dugufu closed 3 months ago

dugufu commented 3 months ago

image

Baiyouzhai commented 3 months ago

My project construction also encountered this issue

dugufu commented 3 months ago

My project construction also encountered this issue

大哥你是 本地build 还是上面build的时候出问题 我刚刚解决了

dugufu commented 3 months ago

For my package.json

{ "vite": "^4.5.1", "vite-plugin-ejs": "^1.7.0", "vite-plugin-top-level-await": "^1.4.1" //update this to latest version }

Then rm -r node_modules/ Then run build again

dugufu commented 3 months ago

For my case I cant build dist on githubaction via my yml.file

dugufu commented 3 months ago
production.yml
  name: Publish Panel Prod
  on:
    workflow_dispatch:
    push:
      tags:
        - panel-prod-v*
      paths:
        - packages/panel/**
  jobs:
    deploy:
      name: Preview Panel
      runs-on: ubuntu-latest
      steps:
        - uses: actions/checkout@v4 **use this version**

        - name: Setup Nodejs and yarn with cache
          uses: actions/setup-node@v4 **update this**
          with:
            node-version: "18"

        - uses: pnpm/action-setup@v2 **use this version**
          name: Install pnpm
          id: pnpm-install
          with:
            version: 9 **use this version**
            run_install: false

        - name: Install dependencies
          working-directory: "packages"
          run: cd backend && pnpm i && cd ../panel && pnpm i

        - name: Build
          working-directory: "packages/panel"
          run: pnpm run build:prod

        - name: Publish
          uses: cloudflare/wrangler-action@2.0.0
          with:
            apiToken: ${{ secrets.CF_API_TOKEN_PROD }}
            accountId: ${{ secrets.CF_ACCOUNT_ID_PROD }}
            workingDirectory: "packages/panel/dist"
            command: pages publish spa --project-name=abc--commit-hash $GITHUB_SHA --branch main
dugufu commented 3 months ago

At the end I use correct version and change the yml to correct version then fixed

F-loat commented 3 months ago

worked for me

pnpm i -D @swc/core@~1.6.0
z100h100 commented 3 months ago

我也出现这个情况了 本地build 前段时间还是好的 微信图片_20240718181059

F-loat commented 3 months ago

@z100h100 @swc/core 今天发了 1.7.0 版本,应该是有些不兼容

z100h100 commented 3 months ago

你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。

z100h100 commented 3 months ago

@F-loat 好的 我暂时先去掉这个了

noreng commented 3 months ago

I faced to the same issue. I use pnpm, adding this to the package.json to temporary fix:

"pnpm": {
    "overrides": {
        "@swc/core": "1.6.0"
    }
}

You can do similar with other package managers until this plugin has a proper fix.

Robin-Ln commented 3 months ago

i have the same issue

Chriztiaan commented 3 months ago

I recommend locking the swc/core version in this package or investigating whether this is a bug in swc.

jyjgit commented 3 months ago

现在有解决方案吗,我目前也遇到这个问题😭

luyaozi commented 3 months ago

留个名 我也遇到了

zmannnnn commented 3 months ago

package.json 固定@swc/core版本为1.6.13 { "resolutions": { "**/vite-plugin-top-level-await/@swc/core": "1.6.13" } } 删除node_modules,然后install 企业微信截图_20240719142544

zmannnnn commented 3 months ago

留个名 我也遇到了

企业微信截图_20240719142544

zmannnnn commented 3 months ago

现在有解决方案吗,我目前也遇到这个问题😭

企业微信截图_20240719142544

ningmengxiaorui commented 3 months ago

留个名,我也遇到了

sanhui33 commented 3 months ago

headache :(

zhaona123zn commented 3 months ago

image

webaddkevin commented 3 months ago

me to @swc/core 1.7 不兼容 回退版本

Menci commented 3 months ago

The definition of ctxt field is missing from SWC's typing definitions... I tested and added the field to everywhere the latest SWC requires. I have no time to fix it for SWC...

Pushed v1.4.2, which should have this issue fixed.

MicahZJ commented 1 month ago

worked for me

pnpm i -D @swc/core@~1.6.0

确实是版本问题

z100h100 commented 1 month ago

你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。