Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upDynamic Imports require SSR: true flag for Next Export #18556
Comments
|
Marked as bug (did not verify it's actually a bug though) but what you're describing sound unexpected. |


Bug report
The ssr flag in dynamic imports does not match the developer usage of the framework.
Describe the bug
This might be a documentation issue, implementational issue or simply API signature, but it is unexpected for next export websites to require ssr: true for dynamic imports. If set to false, it works in dev but not in export.
To Reproduce
Repo: https://github.com/conanbatt/nextjs-dynamic-imports-export
Expected behavior
As a developer I expect a dynamic import with ```ssr: false`` to work in next export, as it is a non-ssr deployment of the app.
System information
Additional context
Looking at the tests for next export, it seems to use SSR to render the pages, but this causes a mismatch of understanding between how the app is deployed and how it is generated.
Solutions?
1- Make ssr flag work as the intended behavior (albeit it could break API?)
2- Improve documentation on dynamic import AND/OR next export to describe this issue
3- Add additional flag to dynamic imports to handle this case.