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

link generation breaks when trying to use import X as Y syntax #2140

Closed
qballer opened this issue Nov 17, 2019 · 2 comments
Closed

link generation breaks when trying to use import X as Y syntax #2140

qballer opened this issue Nov 17, 2019 · 2 comments
Assignees
Labels

Comments

@qballer
Copy link
Contributor

qballer commented Nov 17, 2019

Describe the bug

Here is a fork for polaris-react - https://github.com/qballer/polaris

The autocomplete component consumes the TextField component and renames TextFiel to BaseTextField. When the compiler runs and isolates it in the capsule the link file is trying to import BaseTextField from TextField - but this export doesn't exist. It's a rename that autocomplete does.

Steps to Reproduce

  1. rm -rf /tmp/bit
  2. clone https://github.com/qballer/polaris
  3. DEBUG=true bit build autocomplete
    ----wait---
  4. Go over the console.log and find the capsule of autocomplete.
  5. go to the capsule folder and you can run tsc directly there to find the faulted link file.

Expected Behavior

Link generation should export the original exports from the component and not the renamed text.

Specifications

bit version : 14.4.3
node version : v12.3.1
npm version : 6.12.0
yarn version : 1.16.0
platform : linux

  • Bit compiler (include version): see github repo
  • Bit tester (include version): N/A
@qballer qballer changed the title link generation breaks when trying to import X as Y syntax link generation breaks when trying to use import X as Y syntax Nov 17, 2019
@qballer
Copy link
Contributor Author

qballer commented Nov 18, 2019

Just to share more context I have the following line of code

import { TextField as BaseTextField } from '../../TextField'

Which keeps this line in the component and the import resolves to the following link file

import { BaseTextField } from '@bit/TextField'

Which breaks. There is no BaseTextField. TextField was just used by AutoComplete in this way.

@davidfirst
Copy link
Member

Fixed in bit-javascript, released a new version and pinned it in bit-bin.

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

No branches or pull requests

2 participants