Skip to content

Commit

Permalink
fix: set server.origin to serve assets in dev mode
Browse files Browse the repository at this point in the history
depends on vuejs/vue#12732
  • Loading branch information
jonaskuske committed Aug 13, 2022
1 parent e997006 commit 9bbadc8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/node/index.ts
Expand Up @@ -28,7 +28,7 @@ let resolvedPostCssConfig: PostCSSConfigResult

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

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

return mergeConfig(serveConfig, extendViteConfig) as InlineConfig
}
Expand Down
5 changes: 5 additions & 0 deletions src/node/types.ts
Expand Up @@ -30,6 +30,11 @@ export interface UserConfig {
*/
alias?: AliasOptions

/**
* Specifies the port for the development server.
*/
port?: number

/**
* Extends Vite's configuration. Will be merged with kirbyup's
* default configuration. Be careful what to extend.
Expand Down

0 comments on commit 9bbadc8

Please sign in to comment.