Bootstrapping
#66938
Replies: 2 comments 6 replies
-
I think, for edge env you should skip importing Do remember that instrumentation runs for node and edge. export async function register() {
if (process.env.NEXT_RUNTIME === 'nodejs') {
await import('./instrumentation-node')
}
if (process.env.NEXT_RUNTIME === 'edge') {
await import('./instrumentation-edge')
}
} |
Beta Was this translation helpful? Give feedback.
6 replies
-
Already solved. Missunderstanding |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Ability to run custom Code before application starts in any environment
Background
As far as I found out the only ways to run custom code at the application start is by using Instrumentation or edit next.config.js:
However, Instrumenation is not working with alll code e.g. when you import glob then you get an error:
Also the next.config.js workaround is not working with typescript. Only with .js and .mjs files which you import/require then.
Would be lovely if there would be an official way to do a bootsraping.
Proposal
Please create boostrap.js/ts which will execute any custom code before the application is started
Beta Was this translation helpful? Give feedback.
All reactions