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

[Next.js] Edge Runtime not behaving correctly #23

Closed
Zn4rK opened this issue Nov 22, 2023 · 0 comments · Fixed by #24
Closed

[Next.js] Edge Runtime not behaving correctly #23

Zn4rK opened this issue Nov 22, 2023 · 0 comments · Fixed by #24
Labels
bug Something isn't working help wanted Extra attention is needed next.js

Comments

@Zn4rK
Copy link
Contributor

Zn4rK commented Nov 22, 2023

Using Navita imports directly inside routes that has

export const runtime = 'edge';

Causes the compiler to hang.

I can't remember the details of the Next.js implementation completely, but it might be caused by this line:
https://github.com/vercel/next.js/blob/f3132354285fb18c290bf9aad7f8dc7e0550105d/packages/next/src/build/webpack/plugins/flight-client-entry-plugin.ts#L614

Needs investigation and replication.

Lines in Navita that we need to look into:

const findPagesDirResult = findPagesDir(dir, !!resolvedNextConfig.experimental.appDir);
const hasAppDir = !!(findPagesDirResult && findPagesDirResult.appDir);
const isServer = options.isServer && !(options.nextRuntime === 'edge')
const outputCss = !isServer || hasAppDir;
if (!hasAppDir && !isServer) {
const filename = dev
? 'static/css/[name].css'
: 'static/css/[contenthash].css';
// https://github.com/vercel/next.js/blob/930db5c1afbe541a0b2357c26123c2b365b56624/packages/next/src/build/webpack/config/blocks/css/index.ts#L595
config.plugins.push(
new MiniCssExtractPlugin({
filename,
chunkFilename: filename,
ignoreOrder: true,
}),
);
}

@Zn4rK Zn4rK added bug Something isn't working help wanted Extra attention is needed next.js labels Nov 22, 2023
@Zn4rK Zn4rK closed this as completed in #24 Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed next.js
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant