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 standalone mode excludes @bull-board/ui package from final build #802

Open
j4tmr opened this issue Aug 29, 2024 · 3 comments
Open

Comments

@j4tmr
Copy link

j4tmr commented Aug 29, 2024

Describe the Bug

When using Next.js in standalone mode, the @bull-board/ui package is not included in the final build, even though it is listed as a dependency in the package.json. The package itself contains important static files required for the UI, but these files are missing from the final standalone output.

Root Cause

The reason for this issue is that the @bull-board/ui package does not get directly imported into the application code. Next.js's standalone mode uses a file-tracing mechanism that relies on analyzing direct imports and references in the code to determine which files and packages should be included in the final build output. Since @bull-board/ui is not directly imported but rather contains static assets that are necessary for the UI, the file-tracing mechanism does not detect it as needed for inclusion in the build. Consequently, the package's contents are omitted from the final standalone output, leading to missing assets and broken functionality.

Expected Behavior

The @bull-board/ui package, along with all its static files, should be included in the standalone output when it's listed as a dependency.

Suggested Solution

It would be beneficial if Next.js's standalone build process could more effectively handle such packages that contain essential static files but are not directly imported. One approach could be to enhance the file-tracing mechanism to consider these types of dependencies or provide a configuration option to manually include them.

@felixmosh
Copy link
Owner

Do you have any insights of how to solve it?
AS far as I know, next.js standalone mode has the ability to copy static files, do that, and provide your own options.uiBasePath.

@j4tmr
Copy link
Author

j4tmr commented Aug 29, 2024

@felixmosh I tried several ways, including nextjs's webpack configuration, but none of them worked. Your solution should be the same as me copying node_modules/@bull-board/ui directly to standalone in ci/cd. It needs to be copied dynamically.

@felixmosh
Copy link
Owner

What is the problem of this solution? it works.

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

No branches or pull requests

2 participants