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

fix incorrect import path in copy + preserveModules mode #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lgodziejewski
Copy link

Description

When using copy + preserveModules, the final import path was incorrect:

e.g. dir structure:

src
  components
    ComponentA
      ComponentA.js
      assets
        fancy-asset.svg

so the original import was ./assets/fancy-asset.svg

after building, the structure was:

build
  components
    ComponentA
      ComponentA.js
  assets
    fancy-asset.svg

but the import path was ../../../assets/fancy-assets.svg instead of ../../assets/fancy-assets.svg.

The reason was that the final path was calculated based on the "wrapper file" (i.e. src/components/ComponentA/assets/fanc-asset.svg.js) instead of the importing file - I changed the implementation and the existing test.

Let me know if that's fine or perhaps if I should leave the existing case and just add a new one.

@lgodziejewski lgodziejewski marked this pull request as ready for review December 3, 2021 11:07
@Harris-Miller
Copy link

Bump

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

Successfully merging this pull request may close these issues.

2 participants