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

feat: support format option for transform #350

Closed
wants to merge 2 commits into from

Conversation

sastan
Copy link

@sastan sastan commented Aug 26, 2020

This allows to use transform to output a different format without
going through build which would resolve all imports.

Import handling:

  • cjs: imports are not resolved and re-written as require calls
  • iife: any import will throw

@nathanforce
Copy link

Love to see this! Is there any way I can test this out against my project locally?

This allows to use `transform` to output a different format without
going through `build` which would resolve all imports.

Import handling:

- `cjs`: imports are not resolved and re-written as `require` calls
- `iife`: any import will through
@sastan
Copy link
Author

sastan commented Sep 4, 2020

@nathanforce I have no published package. You need to check out the branch and use make platform-all to have a bundle.

@sastan
Copy link
Author

sastan commented Sep 4, 2020

@evanw Can i help with anything to get this PR merged? Very much open to feedback on this PR if you have suggestions for improvements.

@evanw
Copy link
Owner

evanw commented Sep 6, 2020

Thank you for putting this PR together. However, this is sufficiently complicated and enough of a core part of esbuild that I don't think implementing this as an external contribution makes sense. Some examples of things that aren't handled here:

  • Making this work the same way with transforming and with building without bundling
  • Making sure transforming doesn't touch the file system
  • Handling lazy exports from various non-JavaScript loaders

I have also already started work on implementing #109 and am most of the way there. I will make sure this works as a part of the work for #109.

@evanw
Copy link
Owner

evanw commented Sep 7, 2020

Closing this as #109 has just been implemented.

@evanw evanw closed this Sep 7, 2020
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.

3 participants