Skip to content

fix(es/module): Preserve order for import foo = require("mod") #5215

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

Merged
merged 3 commits into from
Jul 16, 2022

Conversation

magic-akari
Copy link
Member

@magic-akari magic-akari commented Jul 15, 2022

Description:

Import/Export should be hoisted, but Ts Import require should be kept in order.

Input code

import A = require("a"); // print a
console.log(1);
import B = require("b"); // print b

Before this pull request:

"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
const _a = require("a");
const _b = require("b");
console.log(1);

This pull request change:

"use strict";
Object.defineProperty(exports, "__esModule", {
    value: true
});
const A = require("a"); // print a
console.log(1);
const B = require("b"); // print b

BREAKING CHANGE:

Related issue (if exists):

@magic-akari magic-akari changed the title fix(es/module): preserve import foo = require("mod") order fix(es/module): preserve order for import foo = require("mod") Jul 15, 2022
@magic-akari magic-akari changed the title fix(es/module): preserve order for import foo = require("mod") fix(es/module): Preserve order for import foo = require("mod") Jul 15, 2022
@magic-akari magic-akari marked this pull request as ready for review July 15, 2022 03:57
@kdy1 kdy1 added this to the Planned milestone Jul 15, 2022
Copy link
Member

@kdy1 kdy1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!


swc-bump:

  • swc_ecma_transforms_module

@kdy1 kdy1 enabled auto-merge (squash) July 16, 2022 06:44
Copy link
Collaborator

@swc-bot swc-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Automated review comment generated by auto-rebase script

@kdy1 kdy1 merged commit 6b1ce09 into swc-project:main Jul 16, 2022
@magic-akari magic-akari deleted the es/module/import-equals branch July 16, 2022 18:54
@kdy1 kdy1 modified the milestones: Planned, v1.2.217, v1.2.218 Jul 17, 2022
GiveMe-A-Name pushed a commit to GiveMe-A-Name/swc that referenced this pull request Jul 23, 2022
@swc-project swc-project locked as resolved and limited conversation to collaborators Oct 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants