Skip to content

Commit

Permalink
fix(vite): root for running the builder
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Mar 1, 2023
1 parent b87f838 commit 75adbb7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/vite/src/utils/options-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { ViteDevServerExecutorOptions } from '../executors/dev-server/schema';
import { VitePreviewServerExecutorOptions } from '../executors/preview-server/schema';
import replaceFiles from '../../plugins/rollup-replace-files.plugin';
import { ViteBuildExecutorOptions } from '../executors/build/schema';
import * as path from 'path';

/**
* Returns the path to the vite config file or undefined when not found.
Expand Down Expand Up @@ -70,9 +71,14 @@ export function getViteSharedConfig(
const projectRoot =
context.projectsConfigurations.projects[context.projectName].root;

const root = path.relative(
context.cwd,
joinPathFragments(context.root, projectRoot)
);

return {
mode: options.mode,
root: projectRoot,
root,
base: options.base,
configFile: normalizeViteConfigFilePath(projectRoot, options.configFile),
plugins: [replaceFiles(options.fileReplacements) as PluginOption],
Expand Down

0 comments on commit 75adbb7

Please sign in to comment.