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

feat: copyPublicDir out of experimental #14051

Merged
merged 3 commits into from
Aug 21, 2023
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
1 change: 0 additions & 1 deletion docs/config/build-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ By default, Vite will empty the `outDir` on build if it is inside project root.

## build.copyPublicDir

- **Experimental:** [Give feedback](https://github.com/vitejs/vite/discussions/13807)
- **Type:** `boolean`
- **Default:** `true`

Expand Down
1 change: 0 additions & 1 deletion packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@ export interface BuildOptions {
/**
* Copy the public directory to outDir on write.
* @default true
* @experimental
*/
copyPublicDir?: boolean
/**
Expand Down
10 changes: 9 additions & 1 deletion playground/resolve/__tests__/resolve.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import fs from 'node:fs'
import path from 'node:path'
import { expect, test } from 'vitest'
import { isBuild, isWindows, page } from '~utils'
import { isBuild, isWindows, page, testDir } from '~utils'

test('bom import', async () => {
expect(await page.textContent('.utf8-bom')).toMatch('[success]')
Expand Down Expand Up @@ -199,3 +201,9 @@ test('Resolving slash with imports filed', async () => {
test('Resolving from other package with imports field', async () => {
expect(await page.textContent('.imports-pkg-slash')).toMatch('[success]')
})

test.runIf(isBuild)('public dir is not copied', async () => {
expect(
fs.existsSync(path.resolve(testDir, 'dist/should-not-be-copied')),
).toBe(false)
})
Empty file.
3 changes: 3 additions & 0 deletions playground/resolve/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,7 @@ export default defineConfig({
'@vitejs/test-resolve-sharp-dir',
],
},
build: {
copyPublicDir: false,
},
})
5 changes: 5 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.