feat(nuxt): Make dynamic import() wrapping default#13958
Conversation
❌ 5 Tests Failed:
View the top 3 failed tests by shortest run time
To view individual test run time comparison to the main branch, go to the Test Analytics Dashboard |
size-limit report 📦
|
packages/nuxt/src/common/types.ts
Outdated
| * Enabling basic server tracing can be used for environments where modifying the node option `--import` is not possible. | ||
| * However, enabling this option only supports limited tracing instrumentation. Only http traces will be collected (but no database-specific traces etc.). | ||
| * If this option is `false`, the Sentry SDK won't wrap the server entry file with `import()`. Not wrapping the | ||
| * server entry file will disable Sentry on the server-side. When you set this option to `true`, make sure |
There was a problem hiding this comment.
| * server entry file will disable Sentry on the server-side. When you set this option to `true`, make sure | |
| * server entry file will disable Sentry on the server-side. When you set this option to `false`, make sure |
I think it should say false here?
There was a problem hiding this comment.
true is correct here, but I'll rephrase the JSDoc a bit so it is less confusing :)
d211c67 to
e12c03c
Compare
packages/nuxt/src/common/types.ts
Outdated
| * @default true | ||
| */ | ||
| experimental_basicServerTracing?: boolean; | ||
| dynamicImportWrapping?: boolean; |
There was a problem hiding this comment.
I am not sure about the naming here as it is quite technical but describes what it does. I thought about some other names such as autoSentryPreload (as Sentry is preloaded with this), dynamicImportForServerEntry (longer, more descriptive).
There was a problem hiding this comment.
would go with dynamicImportForServerEntry
packages/nuxt/src/common/types.ts
Outdated
| * @default true | ||
| */ | ||
| experimental_basicServerTracing?: boolean; | ||
| dynamicImportWrapping?: boolean; |
There was a problem hiding this comment.
would go with dynamicImportForServerEntry
While the preset for Netlify exports the serverless handler function as
`export { D as default }`, the Vercel preset exports this handler as
`export { D as handler };`.
This PR makes some adaptions to the code generation in the plugin to
make it possible to re-export `default` functions. The previous snippet
did not work as `default` is obviously not allowed as a function name.
7a54dcd to
f0577d2
Compare
BREAKING CHANGE: The
--importflag must not be added anymore. If it is still set, the server-side will be initialized twice and this leads to unexpected errors.First merge this: #13945
Part of this: #13943
This PR makes it the default to include a rollup plugin that wraps the server entry file with a dynamic import (
import()). This is a replacement for the node--importCLI flag.If you still want to manually add the CLI flag you can use this option in the
nuxt.config.tsfile:(option name is up for discussion)