Skip to content

Commit 051e1fd

Browse files
committed
fix: use namespace import for vite instead of named imports
1 parent 4a13866 commit 051e1fd

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

packages/kit/src/core/build/build_service_worker.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fs from 'fs';
2-
import { build } from 'vite';
2+
import * as vite from 'vite';
33
import { s } from '../../utils/misc.js';
44
import { deep_merge } from '../../utils/object.js';
55
import { normalize_path } from '../../utils/url.js';
@@ -22,12 +22,12 @@ export async function build_service_worker(
2222
prerendered,
2323
client_manifest
2424
) {
25-
const build_files = new Set();
25+
const build = new Set();
2626
for (const key in client_manifest) {
2727
const { file, css = [], assets = [] } = client_manifest[key];
28-
build_files.add(file);
29-
css.forEach((file) => build_files.add(file));
30-
assets.forEach((file) => build_files.add(file));
28+
build.add(file);
29+
css.forEach((file) => build.add(file));
30+
assets.forEach((file) => build.add(file));
3131
}
3232

3333
const service_worker = `${config.kit.outDir}/generated/service-worker.js`;
@@ -43,7 +43,7 @@ export async function build_service_worker(
4343
};
4444
4545
export const build = [
46-
${Array.from(build_files)
46+
${Array.from(build)
4747
.map((file) => `${s(`${config.kit.paths.base}/${config.kit.appDir}/${file}`)}`)
4848
.join(',\n\t\t\t\t')}
4949
];
@@ -96,5 +96,5 @@ export async function build_service_worker(
9696

9797
print_config_conflicts(conflicts, 'kit.vite.', 'build_service_worker');
9898

99-
await build(merged_config);
99+
await vite.build(merged_config);
100100
}

packages/kit/src/core/build/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { build } from 'vite';
1+
import * as vite from 'vite';
22

33
/**
44
* @typedef {import('rollup').RollupOutput} RollupOutput
@@ -8,7 +8,7 @@ import { build } from 'vite';
88

99
/** @param {import('vite').UserConfig} config */
1010
export async function create_build(config) {
11-
const { output } = /** @type {RollupOutput} */ (await build(config));
11+
const { output } = /** @type {RollupOutput} */ (await vite.build(config));
1212

1313
const chunks = output.filter(
1414
/** @returns {output is OutputChunk} */ (output) => output.type === 'chunk'

packages/kit/src/core/dev/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'path';
22
import { svelte } from '@sveltejs/vite-plugin-svelte';
3-
import { createServer, searchForWorkspaceRoot } from 'vite';
3+
import * as vite from 'vite';
44
import { deep_merge } from '../../utils/object.js';
55
import { print_config_conflicts } from '../config/index.js';
66
import { get_aliases, get_runtime_path } from '../utils.js';
@@ -33,7 +33,7 @@ export async function dev({ cwd, port, host, https, config }) {
3333
config.kit.outDir,
3434
path.resolve(cwd, 'src'),
3535
path.resolve(cwd, 'node_modules'),
36-
path.resolve(searchForWorkspaceRoot(cwd), 'node_modules')
36+
path.resolve(vite.searchForWorkspaceRoot(cwd), 'node_modules')
3737
])
3838
]
3939
},
@@ -94,7 +94,7 @@ export async function dev({ cwd, port, host, https, config }) {
9494
merged_config.server.port = port;
9595
}
9696

97-
const server = await createServer(merged_config);
97+
const server = await vite.createServer(merged_config);
9898
await server.listen(port);
9999

100100
const address_info = /** @type {import('net').AddressInfo} */ (

0 commit comments

Comments
 (0)