Skip to content

Commit d828ca4

Browse files
authored
[fix] allow user to set dev port (#5303)
1 parent cfd38d4 commit d828ca4

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.changeset/four-glasses-explain.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@sveltejs/kit': patch
3+
---
4+
5+
[fix] allow user to set dev port

packages/kit/src/vite/index.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,11 @@ function kit() {
149149
},
150150
preview: {
151151
port: config.preview?.port ?? 3000,
152-
strictPort: true
152+
strictPort: config.preview?.strictPort ?? true
153153
},
154154
resolve: {
155155
alias: get_aliases(svelte_config.kit)
156156
},
157-
root: cwd,
158157
server: {
159158
fs: {
160159
allow: [
@@ -168,16 +167,15 @@ function kit() {
168167
])
169168
]
170169
},
171-
port: 3000,
172-
strictPort: true,
170+
port: config.server?.port ?? 3000,
171+
strictPort: config.server?.strictPort ?? true,
173172
watch: {
174173
ignored: [
175174
// Ignore all siblings of config.kit.outDir/generated
176175
`${posixify(svelte_config.kit.outDir)}/!(generated)`
177176
]
178177
}
179-
},
180-
spa: false
178+
}
181179
};
182180
},
183181

@@ -334,8 +332,8 @@ function kit() {
334332
/**
335333
* @param {Record<string, any>} config
336334
* @param {Record<string, any>} enforced_config
337-
* @param {string} path
338-
* @param {string[]} out
335+
* @param {string} [path]
336+
* @param {string[]} [out] used locally to compute the return value
339337
*/
340338
function find_overridden_config(config, enforced_config, path = '', out = []) {
341339
for (const key in enforced_config) {

0 commit comments

Comments
 (0)