Skip to content

_Really_ don't inline dynamic imports #946

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

Merged

Conversation

penalosa
Copy link
Contributor

Take 2 of #940, which was still inlining dynamic imports due to esbuild's minification algorithm removing the intermediate variables.

Copy link

changeset-bot bot commented Feb 27, 2025

🦋 Changeset detected

Latest commit: 30d692a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@cloudflare/next-on-pages Patch
eslint-plugin-next-on-pages Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@@ -108,6 +108,10 @@ export async function getSuspenseCacheAdaptor(): Promise<CacheAdaptor> {
return getInternalCacheAdaptor('cache-api');
}

async function doImport(m: string) {
Copy link
Member

Choose a reason for hiding this comment

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

I'd add a comment clarifying what this function is for

Comment on lines 35 to 37
async function doImport(m: string) {
return import(m);
}
Copy link
Member

Choose a reason for hiding this comment

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

I'd probably have a single doImport function (maybe in its own file under utils/) so that we can also add comments to it without repetition, etc..

Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

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

Makes sense to me 🙂 , I just left a few nits/suggestions

Copy link
Contributor

github-actions bot commented Feb 27, 2025

🧪 Prereleases are available for testing 🧪

@cloudflare/next-on-pages

You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/13574133319/npm-package-next-on-pages-946

@cloudflare/eslint-plugin-next-on-pages

You can install this latest build in your project with:

npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/next-on-pages/runs/13574133319/npm-package-eslint-plugin-next-on-pages-946

Copy link
Member

@dario-piotrowicz dario-piotrowicz left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for the updates @penalosa 🫶

@dario-piotrowicz dario-piotrowicz merged commit 6b981ee into cloudflare:main Feb 27, 2025
7 of 8 checks passed
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