From: Julien Déramond Date: Mon, 23 Mar 2026 21:33:03 +0000 (+0100) Subject: Docs: fix Bootstrap bundle loading consistency between dev and static builds X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fv6-dev-fix-bootstrap-bundle-docs-loading;p=thirdparty%2Fbootstrap.git Docs: fix Bootstrap bundle loading consistency between dev and static builds --- diff --git a/eslint.config.js b/eslint.config.js index 32196fc176..b72a134ebc 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -274,6 +274,7 @@ export default [ { files: [ 'site/src/assets/application.js', + 'site/src/assets/bootstrap.bundle.js', 'site/src/assets/partials/*.js', 'site/src/assets/search.js', 'site/src/assets/snippets.js', diff --git a/site/src/assets/bootstrap.bundle.js b/site/src/assets/bootstrap.bundle.js new file mode 100644 index 0000000000..f21f382b7e --- /dev/null +++ b/site/src/assets/bootstrap.bundle.js @@ -0,0 +1,3 @@ +import * as bootstrapBundle from '../../../dist/js/bootstrap.bundle.js' + +Object.keys(bootstrapBundle) diff --git a/site/src/components/Scripts.astro b/site/src/components/Scripts.astro index 3ce53e2c4f..a4f3064b94 100644 --- a/site/src/components/Scripts.astro +++ b/site/src/components/Scripts.astro @@ -1,4 +1,5 @@ --- +import { getVersionedBsJsProps } from '@libs/bootstrap' import type { Layout } from '@libs/layout' import DocsScripts from './DocsScripts.astro' @@ -9,6 +10,8 @@ interface Props { const { layout } = Astro.props --- + + diff --git a/site/src/libs/bootstrap.ts b/site/src/libs/bootstrap.ts index 3b03389548..c07e5962e1 100644 --- a/site/src/libs/bootstrap.ts +++ b/site/src/libs/bootstrap.ts @@ -26,6 +26,13 @@ export function getVersionedBsCssProps(direction: 'rtl' | undefined) { export function getVersionedBsJsProps() { let bsJsScriptSrc = '/dist/js/bootstrap.bundle' + if (import.meta.env.DEV) { + return { + type: 'module', + src: '/src/assets/bootstrap.bundle.js' + } satisfies HTMLAttributes<'script'> + } + if (import.meta.env.PROD) { bsJsScriptSrc = `${bsJsScriptSrc}.min` }