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?]: if I use typescript, I can't import a module. #3373

Closed
1 task
eungyeole opened this issue Sep 2, 2021 · 2 comments
Closed
1 task

[Bug?]: if I use typescript, I can't import a module. #3373

eungyeole opened this issue Sep 2, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@eungyeole
Copy link

eungyeole commented Sep 2, 2021

Self-service

  • I'd be willing to implement a fix

Describe the bug

image

As shown in the picture above, using TypeScript, I can't import a module.
Therefore, I added the node linker: node-modules to the .yarnc.yml file and it was imported normally.

But this wasn't the way I wanted it to be.
So I downgrade the TypeScript version to 4.3.5, and this also solved the problem.

But this wasn't the way I wanted it either.
Is there any way to solve this?

To reproduce

package.json

{
  "name": "test",
  "packageManager": "[email protected]",
  "dependencies": {
    "immer": "^9.0.6",
    "typescript": "^4.4.2"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "experimentalDecorators": true,
    "module": "commonjs",
    "target": "es2018",
    "lib": [
      "esnext"
    ],
  },
  "include": [
    "src/**/*.ts"
  ]
}

.yarnrc.yml

plugins:
  - path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
    spec: "@yarnpkg/plugin-typescript"

yarnPath: .yarn/releases/yarn-berry.cjs

Environment

System:
OS: macOS 11.4
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Binaries:
Node: 16.2.0 - /private/var/folders/0l/txz4jsg559s1681bszrjjxkr0000gn/T/xfs-4975a7ce/node
Yarn: 3.0.1 - /private/var/folders/0l/txz4jsg559s1681bszrjjxkr0000gn/T/xfs-4975a7ce/yarn
npm: 7.20.3 - /usr/local/bin/npm

Additional context

No response

@eungyeole eungyeole added the bug Something isn't working label Sep 2, 2021
@merceyz
Copy link
Member

merceyz commented Sep 2, 2021

Duplicate of #3350

@merceyz merceyz marked this as a duplicate of #3350 Sep 2, 2021
@merceyz merceyz closed this as completed Sep 2, 2021
@merceyz
Copy link
Member

merceyz commented Sep 2, 2021

The fix is to run the following command

yarn set version canary && yarn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants