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]: verbatimModuleSyntax support #14047

Closed
simPod opened this issue Apr 3, 2023 · 7 comments
Closed

[Bug]: verbatimModuleSyntax support #14047

simPod opened this issue Apr 3, 2023 · 7 comments

Comments

@simPod
Copy link

simPod commented Apr 3, 2023

Version

v29.5.0

Steps to reproduce

I have upgraded to TS v5. I had to replace importsNotUsedAsValues: 'error' with verbatimModuleSyntax: true

Expected behavior

No error.

Actual behavior

ESM syntax is not allowed in a CommonJS module when 'verbatimModuleSyntax' is enabled.

for import { xxx } from './xxx';

Additional context

config

module.exports = {
  preset: 'ts-jest',
};

Environment

System:
    OS: macOS 13.2.1
    CPU: (10) arm64 Apple M1 Max
  Binaries:
    Node: 19.6.1 - /opt/homebrew/bin/node
    Yarn: 4.0.0-rc.42 - /opt/homebrew/bin/yarn
    npm: 9.4.0 - /opt/homebrew/bin/npm
@mrazauskas
Copy link
Contributor

If that is an issue with 'ts-jest', it should be reported to their repo. This is a separate project.

Otherwise please provide minimal reproduction (without 'ts-jest').

@simPod
Copy link
Author

simPod commented Apr 3, 2023

Hm, maybe you're right. I did not think of it as that.

@simPod simPod closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2023
@evantill
Copy link

evantill commented Apr 9, 2023

@Milad
Copy link

Milad commented Apr 17, 2023

I have the same problem without using ts-jest.
But I'm using @tsconfig/svelte@4.0.1

In my jest.config.ts, I have used module.exports instead of ESM's export default. It doesn't feel right, but it works!

@jlowcs
Copy link

jlowcs commented Apr 28, 2023

I also have the same problem without using ts-jest.

@jlowcs
Copy link

jlowcs commented Apr 28, 2023

I think the issue comes from here.

Doing this instead fixes it:

      compilerOptions: {
        module: 'CommonJS',
	verbatimModuleSyntax: false,
      },

Although that throws on TS 4.x.

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants