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: swc emits 'use strict' *after* helper functions #178

Closed
cspotcode opened this issue Feb 12, 2019 · 1 comment · Fixed by #183
Closed

Bug: swc emits 'use strict' *after* helper functions #178

cspotcode opened this issue Feb 12, 2019 · 1 comment · Fixed by #183
Milestone

Comments

@cspotcode
Copy link
Contributor

swc produces this transformed code. 'use strict' comes after the helper function.

function _interopRequireWildcard(obj) {
  // body omitted for github
}
'use strict';
var _ = _interopRequireWildcard(require('lodash'));

Reproduction:

import Path from 'path';
import {transformSync} from 'swc';
const {code} = transformSync(`import * as _ from 'lodash'`, {
    filename: Path.resolve('src/index.ts'),
    jsc: {
        parser: {
            syntax: 'typescript',
            tsx: true,
            decorators: true
        }
    }
});
console.log(code);

With the following .swcrc:

{
  "module": {
    "type": "commonjs"
  }
}
kdy1 added a commit to kdy1/swc that referenced this issue Feb 12, 2019
@kdy1 kdy1 added this to the v1.0.7 milestone Feb 12, 2019
@kdy1 kdy1 mentioned this issue Feb 12, 2019
@kdy1 kdy1 closed this as completed in #183 Feb 12, 2019
@swc-bot
Copy link
Collaborator

swc-bot commented Oct 31, 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 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging a pull request may close this issue.

3 participants