Skip to content
This repository has been archived by the owner on Jan 24, 2025. It is now read-only.

Export default as does not work anymore in v1 #790

Closed
thomasthiebaud opened this issue Apr 12, 2019 · 4 comments
Closed

Export default as does not work anymore in v1 #790

thomasthiebaud opened this issue Apr 12, 2019 · 4 comments

Comments

@thomasthiebaud
Copy link

thomasthiebaud commented Apr 12, 2019

Bug Report

I'm using "docz": "0.13.7" in production and at the root of my project I have an index file that imports all the components and export them like that

export { default as Button } from './components/Button'

If I update to v1, this line throws an error

ERROR  Failed to compile with 1 errors                                                                                                                            9:17:58 AM

 error  in ./src/index.js

Module parse failed: Unexpected token (18:11)
You may need an appropriate loader to handle this file type.
| export { default as Button } from './components/Button';
| 
> if (typeof default !== 'undefined' && default && default === Object(default)) {
|   Object.defineProperty(default, '__filemeta', {
|     enumerable: true,

 @ ./src/components/DateRangePicker/README.mdx 18:0-65 138:27-42 139:34-56 159:35-50 197:27-42 198:34-56 218:35-50 223:20-42 223:65-87 223:113-135 223:159-181 257:27-42 258:
34-56 278:35-50 312:12-27
 @ ./.docz/app/imports.js
 @ ./.docz/app/root.jsx
 @ ./.docz/app/index.jsx
 @ multi ./node_modules/react-dev-utils/webpackHotDevClient.js ./.docz/app/index.jsx

Changing it to

import Button from './components/Button';
export { Button }

fix it but it is very annoying if I have to change all my components

Environment

  • OS: OSX 10.14.4
  • Node: v10.15.3
  • npm: 6.4.1
@cupofjoakim
Copy link

We've got the same issue. Anyone know what kind of loader is needed?

@dartess
Copy link

dartess commented Apr 12, 2019

same problem with functions in index file:

// Button.jsx
import {b} from './a';

// a.js
export {default as b} from './b';

// b.js
export const b = null;
./src/components/a.js 3:11
Module parse failed: Unexpected token (3:11)
You may need an appropriate loader to handle this file type.
| export { default as b } from './b';
| 
> if (typeof default !== 'undefined' && default && default === Object(default)) {
|   Object.defineProperty(default, '__filemeta', {
|     enumerable: true,

@fi3ework
Copy link
Contributor

I just made a workaround. I think it's enough for this issue. @pedronauck

@fi3ework
Copy link
Contributor

Should be fixed by #790 and #805, closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants