Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] change Vite's output directory from _app to client #5620

Merged
merged 3 commits into from
Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/strong-cats-wonder.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@sveltejs/kit': patch
---

[fix] change Vite's output directory from `_app` to client
1 change: 0 additions & 1 deletion packages/kit/src/core/generate_manifest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ export function generate_manifest({ build_data, relative_path, routes, format =

// prettier-ignore
return `{
appDir: ${s(build_data.app_dir)},
Rich-Harris marked this conversation as resolved.
Show resolved Hide resolved
assets: new Set(${s(assets)}),
Rich-Harris marked this conversation as resolved.
Show resolved Hide resolved
mimeTypes: ${s(get_mime_lookup(build_data.manifest_data))},
_: {
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/vite/build/build_server.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export class Server {
manifest,
method_override: ${s(config.kit.methodOverride)},
paths: { base, assets },
prefix: assets + '/${config.kit.appDir}/',
prefix: assets + '/',
prerender: {
default: ${config.kit.prerender.default},
enabled: ${config.kit.prerender.enabled}
Expand Down
2 changes: 1 addition & 1 deletion packages/kit/src/vite/build/build_service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export async function build_service_worker(

export const build = [
${Array.from(build)
.map((file) => `${s(`${config.kit.paths.base}/${config.kit.appDir}/${file}`)}`)
.map((file) => `${s(`${config.kit.paths.base}/${file}`)}`)
.join(',\n\t\t\t\t')}
];

Expand Down
8 changes: 4 additions & 4 deletions packages/kit/src/vite/build/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ export const get_default_config = function ({ config, input, ssr, outDir }) {
input,
output: {
format: 'esm',
entryFileNames: ssr ? '[name].js' : 'immutable/[name]-[hash].js',
chunkFileNames: 'immutable/chunks/[name]-[hash].js',
assetFileNames: 'immutable/assets/[name]-[hash][extname]'
entryFileNames: ssr ? '[name].js' : `${config.kit.appDir}/immutable/[name]-[hash].js`,
chunkFileNames: `${config.kit.appDir}/immutable/chunks/[name]-[hash].js`,
assetFileNames: `${config.kit.appDir}/immutable/assets/[name]-[hash][extname]`
},
preserveEntrySignatures: 'strict'
},
Expand Down Expand Up @@ -140,7 +140,7 @@ export function assets_base(config) {
// during `svelte-kit preview`, because we use a local asset path. This
// may be fixed in Vite 3: https://github.com/vitejs/vite/issues/2009
const { base, assets } = config.paths;
return `${assets || base}/${config.appDir}/`;
return `${assets || base}/`;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions packages/kit/src/vite/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ function kit() {
paths = {
build_dir: `${svelte_config.kit.outDir}/build`,
output_dir: `${svelte_config.kit.outDir}/output`,
client_out_dir: `${svelte_config.kit.outDir}/output/client/${svelte_config.kit.appDir}`
client_out_dir: `${svelte_config.kit.outDir}/output/client/`
};

if (is_build) {
Expand Down Expand Up @@ -271,7 +271,7 @@ function kit() {
});

fs.writeFileSync(
`${paths.client_out_dir}/version.json`,
`${paths.client_out_dir}/${svelte_config.kit.appDir}/version.json`,
JSON.stringify({ version: svelte_config.kit.version.name })
);

Expand Down Expand Up @@ -316,8 +316,8 @@ function kit() {

const files = new Set([
...static_files,
...chunks.map((chunk) => `${svelte_config.kit.appDir}/${chunk.fileName}`),
...assets.map((chunk) => `${svelte_config.kit.appDir}/${chunk.fileName}`)
...chunks.map((chunk) => chunk.fileName),
...assets.map((chunk) => chunk.fileName)
]);

// TODO is this right?
Expand Down