-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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(cli): support dynamic imports from cjs #22638
base: master
Are you sure you want to change the base?
Conversation
Missing ChangesetsThe following package(s) are changed by this PR but do not have a changeset:
See CONTRIBUTING.md for more information about how to add changesets. Changed Packages
|
Uffizzi Ephemeral Environment - Virtual Cluster☁️ deploying cluster ⚙️ Updating now by workflow run 8608047205. Download the Uffizzi CLI to interact with the upcoming virtual cluster |
3cba01b
to
617b685
Compare
The E2E test failure is definitely related to this work,
I'll investigate this week. |
This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution! |
d25d020
to
afb326a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! 🎉 👏
Big step towards module support. Gonna play it safe and ship this after the next main-line.
This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution! |
@Rugvip this was still of interest right |
@freben yep 👍 |
This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution! |
This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution! |
This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution! |
@Rugvip (sorry for the late response here) I think I misread the rollup option and assumed it was doing both imports. When I was initially working on this, I noticed some fairly odd behavior around relative dynamic imports with rollup. I just pushed a commit with such a broken state in |
@aramissennyeydd alright, thank you for the update 👍 Could let it sit for the time being if you want, I might poke around at this some more at some point too. Regarding Webpack we'll get rid of that in not too long for backend builds, it'll be part of deprecating support for the old backend system. |
Ah, sorry, had meant rollup 😅 . I'll try and wade through the rollup/webpack/swc miasma next week and see if I can come up with anything. The mismatch between documented options and output is bugging me a little. |
This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution! |
fe873c5
to
ed6ab33
Compare
Signed-off-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
Signed-off-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
Signed-off-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
Signed-off-by: Aramis Sennyey <159921952+aramissennyeydd@users.noreply.github.com> Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
Signed-off-by: aramissennyeydd <aramis.sennyey@doordash.com>
4e58b18
to
3eca7c5
Compare
@Rugvip I think I'm getting closer, the SWC maintainer pointed me to an
and
Those were both being compiled to require statements with the correct file mappings (not necessarily the same as the source files). I don't think we can have it both ways of using imports and expecting some compiled and some uncompiled code. It also means we'll have to adjust package definitions to better support ESM resolution, TS is not well behaved here (TypeStrong/ts-node#1997). The error on our side looks like,
I did to a few PRs here, basically adjusting the |
This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution! |
Hey, I just made a Pull Request!
might fix #8242?
Context: I ran into the ESM module support issue while testing out
ink
+ a new Backstage CLI. It would be great to start the ball rolling on adding support and this seems like the first blocker.This PR adds a new plugin that handles rollup's
resolveDynamicPlugin
andrenderDynamicPlugin
methods. Currently, I enabled it just for non-relative files as the bundler doesn't pick up relative.mjs
files directly. Given the context of where this would be used, I doubt that that is a necessary usecase as well. I did see that the commonjs plugin is set up to run against just node_modules,Not sure if that impacts this work. From what I can tell, the resolutions for the dynamic imports work despite this, but it may require further investigation. Interestingly, I only needed to change the build config, and was able to leave the webpack config untouched.
Testing plan: I'm not quite sure what else should be tested here. I ran both the
build
andstart
commands with dynamic imports and they worked as expected (like the snapshot in the rollup test). Would love ideas here.✔️ Checklist
Signed-off-by
line in the message. (more info)