mirror of
https://github.com/gotson/komga.git
synced 2025-12-06 08:32:25 +01:00
fix storybook build
This commit is contained in:
parent
8e0620bb68
commit
8dacf906fa
1 changed files with 15 additions and 11 deletions
|
|
@ -22,7 +22,7 @@ const dirname =
|
||||||
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url))
|
typeof __dirname !== 'undefined' ? __dirname : path.dirname(fileURLToPath(import.meta.url))
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig(({ mode }) => ({
|
||||||
plugins: [
|
plugins: [
|
||||||
VueRouter({
|
VueRouter({
|
||||||
dts: 'src/typed-router.d.ts',
|
dts: 'src/typed-router.d.ts',
|
||||||
|
|
@ -82,16 +82,20 @@ export default defineConfig({
|
||||||
port: 3000,
|
port: 3000,
|
||||||
},
|
},
|
||||||
base: '/',
|
base: '/',
|
||||||
// support for the runtime base url (depending on the server.servlet.context-path)
|
// use 'prod' when building the app because storybook always use 'production' and cannot be configured.
|
||||||
// window.buildUrl is a function defined in index.html that dynamically provides the path
|
// if renderBuiltUrl is used, Storybook doesn't work
|
||||||
// it only works within js files though
|
...(mode === 'prod' && {
|
||||||
experimental: {
|
// support for the runtime base url (depending on the server.servlet.context-path)
|
||||||
renderBuiltUrl(filename, { hostType }) {
|
// window.buildUrl is a function defined in index.html that dynamically provides the path
|
||||||
if (hostType === 'js') return { runtime: `window.buildUrl(${JSON.stringify(filename)})` }
|
// it only works within js files though
|
||||||
// else if (hostType === 'html') return `@{/${filename}}`
|
experimental: {
|
||||||
else return { relative: true }
|
renderBuiltUrl(filename, { hostType }) {
|
||||||
|
if (hostType === 'js') return { runtime: `window.buildUrl(${JSON.stringify(filename)})` }
|
||||||
|
// else if (hostType === 'html') return `@{/${filename}}`
|
||||||
|
else return { relative: true }
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
}),
|
||||||
optimizeDeps: {
|
optimizeDeps: {
|
||||||
exclude: ['vuetify'],
|
exclude: ['vuetify'],
|
||||||
},
|
},
|
||||||
|
|
@ -136,4 +140,4 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
})
|
}))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue