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

Crash with some rewritten imports #1566

Closed
dustinsoftware opened this issue Mar 23, 2020 · 2 comments
Closed

Crash with some rewritten imports #1566

dustinsoftware opened this issue Mar 23, 2020 · 2 comments

Comments

@dustinsoftware
Copy link

dustinsoftware commented Mar 23, 2020

Current behavior

Some imports are not rewritten correctly and produce naming collisions.

image

Looks like the logic in this file does not handle unique identifiers for all cases: https://github.com/styleguidist/react-styleguidist/blob/3469cbba172d9f81657b388dbffbb8fd5dd7fba4/src/client/utils/rewriteImports.ts

These imports:

import Demo from './demo1/component.js';
import Demo2 from './demo2/component.js';

<Button><Demo /><Demo2 /></Button>

Get transformed into:

const component_js$0 = require('./demo1/component.js');
const Demo = component_js$0.default || component_js$0;
const component_js$0 = require('./demo2/component.js');
const Demo2 = component_js$0.default || component_js$0;

React.createElement( Button, null, React.createElement( Demo, null ), React.createElement( Demo2, null ) )

To reproduce

Demo here: https://github.com/dustinsoftware/styleguidist-example/

Expected behavior

Unique identifier names are used.

@sapegin
Copy link
Member

sapegin commented Mar 25, 2020

Feel free to send a pull request with a fix.

This will also go away after #1553.

@styleguidist-bot
Copy link
Collaborator

🎉 This issue has been resolved in version 11.0.5 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

No branches or pull requests

3 participants