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

import foo = require should be normal AMD dependency #4898

Closed
jrieken opened this issue Jun 7, 2022 · 1 comment · Fixed by #4906
Closed

import foo = require should be normal AMD dependency #4898

jrieken opened this issue Jun 7, 2022 · 1 comment · Fixed by #4906
Assignees
Labels
Milestone

Comments

@jrieken
Copy link

jrieken commented Jun 7, 2022

Describe the bug

This code pattern is smelly but when mixing import and require and when targeting AMD then a normal AMD dependency should be inserted

Input code

import assert = require('assert');

assert(true);

Config

{
  "$schema": "http://json.schemastore.org/swcrc",
  "exclude": "\\.js$",
  "jsc": {
    "parser": {
      "syntax": "typescript",
      "tsx": false,
      "decorators": true
    },
    "target": "es2020",
    "loose": false,
    "minify": {
      "compress": false,
      "mangle": false
    }
  },
  "module": {
    "type": "amd",
    "noInterop": true
  },
  "minify": false
}

Playground link

https://play.swc.rs/?version=1.2.197&code=H4sIAAAAAAAAA8vMLcgvKlFILC5OBVK2CkWphaWZRaka6hARdU1rLi4IU6OkqDRV0xoAPEEBujEAAAA%3D&config=H4sIAAAAAAAAA0WOTQ6DQAhG70JcNmpceoPewc1kxL84wwQw1RjvXqzR7sjj%2Bx7skIkfMDioYVBNdVFMQjG%2FoCgx5sR9IR%2FPHl6Aq5%2BXFi3dNPkkmaFJPNQ7JMeCfE6yRXWrRXRLKJ7HpBZTMdS5WfAFLXpiZ3KBWnnBw9aOe1QroVRlVVphJhJ8KmGMY7edek8hMYr8Vy728508zBWoXU6w%2Fz4wpwutCSO9oyJTeo7e0qv5BTnH4YgMAQAA

Expected behavior

The assert dependency should be a normal, async AMD dependency, not a sync-require statement, see TS-playrground: https://www.typescriptlang.org/play?module=2#code/JYWwDg9gTgLgBAQwM5IKazgXjlVBHAV2FwAoByZNWMgSgG4AoBy9GEmKA1eoA

Actual behavior

No response

Version

1.2.197

Additional context

related to microsoft/vscode#150025

@swc-bot
Copy link
Collaborator

swc-bot commented Oct 16, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Development

Successfully merging a pull request may close this issue.

3 participants