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

export * as Foo from 'bar' not supported #226

Closed
lily-mara opened this issue Feb 17, 2019 · 8 comments
Closed

export * as Foo from 'bar' not supported #226

lily-mara opened this issue Feb 17, 2019 · 8 comments
Milestone

Comments

@lily-mara
Copy link
Contributor

I tried this:

export * as Foo from 'bar';

I expected to see this happen:

module.exports = {
  Foo: require('bar'),
};

Instead, this happened:

error: Expected Word(from), got Some(Word(as))
 --> test.js:1:10
  |
1 | export * as Foo from 'bar';
  |          ^^

I'm using CLI 0.1.12, @swc/core 1.0.15

@kdy1 kdy1 modified the milestones: v1.0.17, v1.0.16 Feb 18, 2019
kdy1 added a commit to kdy1/swc that referenced this issue Feb 18, 2019
@kdy1 kdy1 closed this as completed in #228 Feb 18, 2019
kdy1 added a commit that referenced this issue Feb 18, 2019
swc_ecma_parser:
 - support `export * as Foo from 'foo';` (Fix #226)

swc_ecma_transforms:
 - support `export * as Foo from 'foo';` (Fix #226)
@kdy1
Copy link
Member

kdy1 commented Feb 18, 2019

Fixed with@swc/[email protected]

@lily-mara
Copy link
Contributor Author

Still having this issue after updating to 1.0.18, and adding the exportNamespaceFrom line to my .swcrc,

error: Expected Comma, got Some(Str { value: Atom('bar' type=inline), has_escape: false })
 --> test.js:1:22
  |
1 | export * as Foo from 'bar';
  |                      ^^^^^

@kdy1 kdy1 modified the milestones: v1.0.16, v1.0.19 Feb 18, 2019
@kdy1 kdy1 reopened this Feb 18, 2019
kdy1 added a commit to swc-project/node-swc that referenced this issue Feb 18, 2019
@kdy1
Copy link
Member

kdy1 commented Feb 18, 2019

@natemara I can't reproduce this.
See https://github.com/swc-project/node-swc/blob/4b098fdb524b565e86e973e32c46f62abfd8d117/__tests__/api_test.js#L12-L25

Did you specified exportNamespaceFrom in jsc.parser?

Maybe I need a test for using .swcrc. It works even with .swcrc


Edit: Done

kdy1 added a commit to swc-project/node-swc that referenced this issue Feb 18, 2019
@lily-mara
Copy link
Contributor Author

here is my .swcrc

{
  "jsc": {
    "parser": {
      "syntax": "ecmascript",
      "dynamicImport": true,
      "classProperty": true,
      "exportDefaultFrom": true,
      "exportNamespaceFrom": true,
      "jsx": true
    }
  },
  "module": {
    "type": "commonjs"
  }
}

And the entirety of the file I'm trying to compile:

export * as Foo from 'bar';

@kdy1
Copy link
Member

kdy1 commented Feb 18, 2019

It errors only when exportDefaultFrom: true is specified.

@lily-mara
Copy link
Contributor Author

Yes, I just realized that too

@kdy1 kdy1 closed this as completed in aa8940c Feb 18, 2019
kdy1 added a commit to kdy1/swc-example that referenced this issue Feb 19, 2019
@kdy1
Copy link
Member

kdy1 commented Feb 19, 2019

Fixed with @swc/core 1.0.20

kdy1 added a commit to kdy1/swc that referenced this issue Nov 25, 2019
@swc-bot
Copy link
Collaborator

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

No branches or pull requests

3 participants