-
Notifications
You must be signed in to change notification settings - Fork 131
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
[Bug]: Blank page errors in production builds when converting from cra 4 #2823
Comments
The JS assets are fallback to Related documentation: https://rsbuild.dev/guide/basic/server#page-routing |
import { defineConfig, loadEnv } from '@rsbuild/core'
import { pluginNodePolyfill } from '@rsbuild/plugin-node-polyfill'
import { pluginReact } from '@rsbuild/plugin-react'
import { pluginSvgr } from '@rsbuild/plugin-svgr'
import { pluginSass } from '@rsbuild/plugin-sass'
const { publicVars } = loadEnv({ prefixes: ['REACT_APP_'] })
export default defineConfig({
plugins: [
pluginReact(),
pluginSvgr({ mixedImport: true }),
pluginNodePolyfill(),
pluginSass(),
],
html: {
template: './public/index.html',
},
source: {
define: publicVars,
},
output: {
distPath: {
root: 'build',
},
assetPrefix: 'auto',
},
}) |
I've also encountered this issue tools: {
rspack(config) {
config.output = {
...config.output,
publicPath: '/'
};
}
} |
@eidellev that seems to have fixed the issue with the blank page, Thanks. Still getting issues with favicons not loading. |
@DevTGhosh |
output: {
assetPrefix: '/',
copy: [
{ from: './public/favicon.ico' },
],
}, |
There was an issue with my config. Fixing that solved the favicon issue. Thanks everyone for the help. considering that the tools > rspack config can change anytime. A better solution should be there for the |
你好,如果你看到我这封邮件,说明我已收到你的信息。若有问题我会抽空回复你。
|
Version
Details
After running the build command and opening any page directly that isn't the
/
page I am getting a blank page and a bunch of errors in the console. It is working fine on the dev server but the production build is causing an issue. The project is being converted from a cra 4 app to rsbuild. The issue seems to be accessing any protected route in react router v6 directly.Console errors.
Reproduce link
don't have a reproducible link
Reproduce Steps
The text was updated successfully, but these errors were encountered: