Skip to content
This repository has been archived by the owner on May 22, 2024. It is now read-only.

fix: only transpile ESM imports when entrypoint is ESM #807

Merged
merged 5 commits into from
Nov 17, 2021

Conversation

eduardoboucas
Copy link
Member

- Summary

The shouldTranspile method was previously returning true for any path that doesn't have a parent, where in reality it must do so only if the path itself is an ESM file.

- Test plan

A new test was added to verify this scenario.

- A picture of a cute animal (not mandatory but encouraged)

sloth-1-102913

@eduardoboucas eduardoboucas added the type: bug code to address defects in shipped code label Nov 12, 2021
@@ -0,0 +1,10 @@
class App {
constructor(event, context) {
return {
Copy link
Contributor

Choose a reason for hiding this comment

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

wait, what? Constructors can return something? this weird

Copy link
Contributor

Choose a reason for hiding this comment

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

but fine for a fixture, I guess ^^

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea was to replicate this scenario, but using a class or not is actually irrelevant for the test case here. All that matters is that the file is ESM.

@@ -0,0 +1,10 @@
class App {
constructor(event, context) {
return {
Copy link
Contributor

Choose a reason for hiding this comment

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

but fine for a fixture, I guess ^^

@eduardoboucas eduardoboucas merged commit a1b0a15 into main Nov 17, 2021
@eduardoboucas eduardoboucas deleted the fix/nft-transpile-check branch November 17, 2021 11:52
Skn0tt pushed a commit to netlify/build that referenced this pull request May 21, 2024
…t-and-ship-it#807)

* fix: only transpile ESM imports when entrypoint is ESM

* chore: fix tests

* chore: fix test on Windows
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants