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 transform() bug #685

Merged
merged 1 commit into from
Jul 31, 2020
Merged

Fix transform() bug #685

merged 1 commit into from
Jul 31, 2020

Conversation

drwpow
Copy link
Collaborator

@drwpow drwpow commented Jul 31, 2020

Changes

Found the bug that https://www.pika.dev/npm/snowpack/discuss/510 was referring to 😅. I encountered this trying to run .vue files through a post-transformation in #684.

This should actually be merged & published soon; without it transform() plugins actually don’t work at all.

Testing

This is difficult to test. I encountered this by running the #684 PostCSS plugin locally.

@drwpow drwpow requested a review from a team as a code owner July 31, 2020 06:16
@vercel
Copy link

vercel bot commented Jul 31, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/pikapkg/snowpack/9guxci1cv
✅ Preview: https://snowpack-git-drwpow-transform-bugfix.pikapkg.vercel.app

@@ -108,9 +108,9 @@ async function runPipelineTransformStep(
urlPath: `./${path.basename(rootFileName + destExt)}`,
});
if (typeof result === 'string') {
output[srcExt] = result;
output[destExt] = result;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit difficult to follow, so here’s an example: .vue files will generate .js and .css. This transform function then runs twice for .js and then for .css.

What was happening was:

  1. output['.vue'] = [js transform]
  2. output['.vue'] = [css transform]

The original srcExt (.vue) was receiving all the transformations, then being blown away. This PR fixes that, and actually keeps the transformations.

Copy link
Owner

@FredKSchott FredKSchott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doh! yup, I'll get this out now actually

@FredKSchott
Copy link
Owner

nice catch

@FredKSchott FredKSchott merged commit d446b80 into master Jul 31, 2020
@FredKSchott FredKSchott deleted the drwpow/transform-bugfix branch July 31, 2020 08:13
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.

None yet

2 participants