Skip to content

Commit 985107c

Browse files
authored
fix(vite): ensure nxCopyAssetsPlugin outputs assets to correct location #28786 (#30585)
## Current Behavior The `nxCopyAssetsPlugin` from `@nx/vite` does not output the asset files to the correct location. It prepends the `rootDir` even when the `outDir` in the `vite.config` resolves to contain the `rootDir`. ## Expected Behavior Only prepend the `rootDir` when it does not already exist ## Related Issue(s) Fixes #28786
1 parent ebd39bb commit 985107c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/vite/plugins/nx-copy-assets.plugin.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ export function nxCopyAssetsPlugin(_assets: (string | AssetGlob)[]): Plugin {
3131
handler = new CopyAssetsHandler({
3232
rootDir: workspaceRoot,
3333
projectDir: config.root,
34-
outputDir: join(config.root, config.build.outDir),
34+
outputDir: config.build.outDir.startsWith(config.root)
35+
? config.build.outDir
36+
: join(config.root, config.build.outDir),
3537
assets,
3638
});
3739
if (this.meta.watchMode && isDaemonEnabled()) {

0 commit comments

Comments
 (0)