Skip to content

Commit 5e17a6b

Browse files
committed
fix: set server.origin to serve assets in dev mode
depends on vuejs/vue#12732
1 parent aee1f96 commit 5e17a6b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/node/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ let resolvedPostCssConfig: PostCSSConfigResult
2828

2929
const getViteConfig: GetViteConfigFn = (command, options) => {
3030
const aliasDir = resolve(options.cwd, dirname(options.entry))
31-
const { alias = {}, extendViteConfig = {} } = resolvedKirbyupConfig
31+
const { alias = {}, port = 5177, extendViteConfig = {} } = resolvedKirbyupConfig
3232

3333
const baseConfig: InlineConfig = {
3434
resolve: {
@@ -45,7 +45,8 @@ const getViteConfig: GetViteConfigFn = (command, options) => {
4545
plugins: [kirbyupHmrPlugin(options), options.watch && fullReloadPlugin(options.watch)],
4646
// Input needs to be specified so dep pre-bundling works
4747
build: { rollupOptions: { input: resolve(options.cwd, options.entry) } },
48-
})
48+
server: { port, strictPort: true, origin: `http://localhost:${port}` },
49+
} as InlineConfig)
4950

5051
return mergeConfig(serveConfig, extendViteConfig) as InlineConfig
5152
}

src/node/types.ts

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ export interface UserConfig {
3030
*/
3131
alias?: AliasOptions
3232

33+
/**
34+
* Specifies the port for the development server.
35+
*/
36+
port?: number
37+
3338
/**
3439
* Extends Vite's configuration. Will be merged with kirbyup's
3540
* default configuration. Be careful what to extend.

0 commit comments

Comments
 (0)