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 Report]: 报错Error: Unexpected token, expected "," 但是代码并没有写这个 #1365

Closed
Wyatex opened this issue Jun 4, 2024 · 1 comment

Comments

@Wyatex
Copy link

Wyatex commented Jun 4, 2024

Steps to reproduce

  1. pnpm i
  2. pnpm build

Reproduce link

https://github.com/MatrixCross/React-Starter

What is actually happening?

build的时候莫名其妙报错,dev就没报错

[ Farm ] Failed to build: Error: Transform `src/index.tsx` failed.
Error: Unexpected token, expected "," (12:33)
SyntaxError: Unexpected token, expected "," (12:33)

我以为是这里的感叹号有问题

const root = createRoot(container!)

但是去掉之后又到另一个文件src/utils/storage.ts报错:

[ Farm ] Failed to build: Error: Transform `src/utils/storage.ts` failed.
Error: Unexpected reserved word 'interface'. (3:0)
SyntaxError: Unexpected reserved word 'interface'. (3:0)

src/utils/storage.ts前面的代码是:

import localforage from 'localforage'

interface StorageData<T> {
  value: T
  expire: number | null
}

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (16) x64 13th Gen Intel(R) Core(TM) i5-13500H
    Memory: 5.12 GB / 31.73 GB
  Binaries:
    Node: 20.10.0 - D:\Program Files\nodejs\node.EXE
    Yarn: 1.22.21 - D:\Program Files\nodejs\yarn.CMD
    npm: 10.2.3 - D:\Program Files\nodejs\npm.CMD
    pnpm: 8.12.1 - D:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Chromium (122.0.2365.66)
    Internet Explorer: 11.0.22621.3527
  npmPackages:
    @farmfe/core: ^1.1.12 => 1.1.12
@shulandmimi
Copy link
Member

duplicate #1328

#1328 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants