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

Syntax error after updating to 1.6.8 #734

Closed
MrFoxPro opened this issue Sep 29, 2023 · 8 comments
Closed

Syntax error after updating to 1.6.8 #734

MrFoxPro opened this issue Sep 29, 2023 · 8 comments

Comments

@MrFoxPro
Copy link

After upgrading from 1.6.7 to 1.6.8, I get following error:

[api] 
[api] node:internal/process/esm_loader:48
[api]       internalBinding('errors').triggerUncaughtException(
[api]                                 ^
[api] [Error: 
[api]   x Expected ',', got '{'
[api]    ,-[file:///home/foxpro/craft/sferadel/dev/api/main.mts:2:1]
[api]  2 | import * as path from "node:path"
[api]  3 | import { availableParallelism } from "node:os"
[api]  4 | import * as fs from "node:fs/promises"
[api]  5 | import type { Worker } from "node:cluster"
[api]    :             ^
[api]  6 | import cluster from "node:cluster"
[api]  7 | import { match } from "ts-pattern"
[api]  8 | import { createYoga } from "graphql-yoga"
[api]    `----
[api] 
[api] 
[api] Caused by:
[api]     Syntax Error] {
[api]   code: 'GenericFailure'
[api] }
[api] 
[api] Node.js v20.6.1
[api] [[Command exited with 1]]

My .swcrc:

{
  "$schema": "https://json.schemastore.org/swcrc",
  "jsc": {
    "baseUrl": ".",
    "parser": {
      "syntax": "typescript"
    },
    "target": "esnext",
    "loose": true,
    "paths": {
      "#/*": ["./*"],
      "#eql": ["./eql/index.mts"],
      "#eql/types": ["./eql/types.d.ts"]
    }
  },
  "module": {
    "type": "es6"
  }
}
My tsconfig.json
{
  "compilerOptions": {
    "strict": false,
    "strictNullChecks": true,
    "strictFunctionTypes": true,

    "baseUrl": ".",
    // "sourceMap": true, // mandatory for SWC
    "target": "ESNext",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    // "resolvePackageJsonImports": true,
    // https://github.com/swc-project/swc-node/pull/723
    "paths": {
      "#/*": ["./*"],
      "#eql": ["./eql/index.mts"],
      "#eql/types": ["./eql/types.d.ts"]
    },

    "noEmit": true,
    "isolatedModules": true,

    "skipDefaultLibCheck": true,
    "skipLibCheck": true
  },
  "exclude": ["**/node_modules", "**/.*/"]
}

I tried with "@swc/core": "^1.3.86" and "@swc/core": "^1.3.90", no difference.

@dmythro
Copy link

dmythro commented Sep 29, 2023

Also got error on importing: Error [ERR_MODULE_NOT_FOUND]: Cannot find module for path alias in tsconfig's paths, but works perfectly fine with v1.6.7.

@cm-ayf
Copy link
Contributor

cm-ayf commented Oct 1, 2023

I authored the PR #727 and I suspect that the PR broke something. I'm going to figure it out.

@EffectivelyEfficient
Copy link

I got the following message from v1.6.8, but not from v1.6.7. This is using esm and the npm package mysql2,

const [tableNames] = await mysqlPool().query<RowDataPacket[]>(·
                                                                  ^···
    SyntaxError: Unexpected token ']'·

@HashemKhalifa
Copy link

same issue here!

@FlorinAsavoaie
Copy link

@cm-ayf any luck with this?

@yeliex
Copy link
Contributor

yeliex commented Mar 4, 2024

#754 should fix this. please test and feedback

@FlorinAsavoaie
Copy link

Looks good. Can be closed.

@AmauryD
Copy link

AmauryD commented Mar 20, 2024

Last release fixed the issue for me

@kdy1 kdy1 closed this as completed Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

9 participants