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 Something from './Something' doesn't work #8875

Closed
igor10k opened this issue Oct 15, 2018 · 4 comments
Closed

export Something from './Something' doesn't work #8875

igor10k opened this issue Oct 15, 2018 · 4 comments
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue

Comments

@igor10k
Copy link

igor10k commented Oct 15, 2018

Bug Report

Current Behavior
After updating to v7 I started getting this error:

Module parse failed: Unexpected token (115:7)
You may need an appropriate loader to handle this file type.
| });
| 
> export TextField from './TextField';

Input Code

index.js:

...
export TextField from './TextField'
...

Textfield.js:

export default 'test'

Expected behavior/code
Expect it to work. And it actually works just fine if I replace export TextField from './TextField' with export { default as TextField } from './TextField'

Babel Configuration (.babelrc, package.json, cli command)

{
  "presets": [
    "@babel/preset-env",
    "@babel/preset-react"
  ],
  "plugins": [
    "@babel/plugin-syntax-export-default-from",
    "@babel/plugin-proposal-function-bind",
    [ "@babel/plugin-proposal-optional-chaining", { "loose": false } ],
    [ "@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false } ],
    "@babel/plugin-proposal-do-expressions",
    [ "@babel/plugin-proposal-class-properties", { "loose": false } ],
    "react-hot-loader/babel"
  ]
}

Environment

  • Babel version(s): 7.1.2
  • Node/npm version: node 10.12.0 / npm 6.4.1
  • OS: macOS 10.14
  • Monorepo yes
  • How you are using Babel: loader
@babel-bot
Copy link
Collaborator

Hey @igor10k! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.

@igor10k
Copy link
Author

igor10k commented Oct 15, 2018

Should've used @babel/proposal-export-default-from instead of @babel/plugin-syntax-export-default-from

@igor10k igor10k closed this as completed Oct 15, 2018
@alex-cory
Copy link

@igor10k could you post your babel setup from package.json or .babelrc so we could see what you did? I'm having this problem even with using @babel/proposal-export-default-from

@igor10k
Copy link
Author

igor10k commented Dec 11, 2018

@alex-cory sure

.babelrc

{
  "presets": [
    "@babel/preset-env",
    "@babel/preset-react"
  ],
  "plugins": [
    "@babel/plugin-proposal-export-default-from",
    "@babel/plugin-proposal-function-bind",
    [ "@babel/plugin-proposal-optional-chaining", { "loose": false } ],
    [ "@babel/plugin-proposal-nullish-coalescing-operator", { "loose": false } ],
    "@babel/plugin-proposal-do-expressions",
    [ "@babel/plugin-proposal-class-properties", { "loose": false } ],
    "react-hot-loader/babel"
  ]
}

@lock lock bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Mar 12, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated A closed issue/PR that is archived due to age. Recommended to make a new issue
Projects
None yet
Development

No branches or pull requests

3 participants