Repository navigation
Bootstrap with SSR production build issues anyone? #440
Unanswered
samtran0331
asked this question in
Q&A
Replies: 0 comments
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.
I was getting this error with production build:
ReferenceError: document is not defined at K (C:\...\vue_src\node_modules\bootstrap\dist\js\bootstrap.min.js:6:8846) at C:\...\vue_src\node_modules\bootstrap\dist\js\bootstrap.min.js:6:9655 at C:\...\vue_src\node_modules\bootstrap\dist\js\bootstrap.min.js:6:84 at Object.<anonymous> (C:\...\vue_src\node_modules\bootstrap\dist\js\bootstrap.min.js:6:256)I got around it by dynamically importing bootstrap only in browser like this, in main.ts:
`const isBrowser = typeof window !== 'undefined'
if (isBrowser) {
await import ('bootstrap/dist/css/bootstrap.min.css')
await import ('bootstrap/dist/js/bootstrap.min.js')
await import ('@progress/kendo-theme-bootstrap/dist/all.css')
}
`
That let me successfully build but Bootstrap isn't loading. Any suggestions on what to look at?
Thanks so much!
All reactions