Skip to content

Commit

Permalink
fix(bundling): pass nxext options to our executor
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed Dec 2, 2022
1 parent 3180427 commit 3ce4391
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
5 changes: 0 additions & 5 deletions docs/generated/packages/vite.json
Expand Up @@ -224,11 +224,6 @@
"description": "Base public path when served in development or production.",
"alias": "base"
},
"proxyConfig": {
"type": "string",
"description": "Path to the proxy configuration file.",
"x-completion-type": "file"
},
"configFile": {
"type": "string",
"description": "The name of the Vite.js configuration file.",
Expand Down
1 change: 0 additions & 1 deletion packages/vite/src/executors/build/schema.d.ts
Expand Up @@ -2,7 +2,6 @@ import type { FileReplacement } from '../../plugins/rollup-replace-files.plugin'
export interface ViteBuildExecutorOptions {
outputPath: string;
baseHref?: string;
proxyConfig?: string;
configFile?: string;
fileReplacements?: FileReplacement[];
sourcemap?: boolean | 'inline' | 'hidden';
Expand Down
5 changes: 0 additions & 5 deletions packages/vite/src/executors/build/schema.json
Expand Up @@ -22,11 +22,6 @@
"description": "Base public path when served in development or production.",
"alias": "base"
},
"proxyConfig": {
"type": "string",
"description": "Path to the proxy configuration file.",
"x-completion-type": "file"
},
"configFile": {
"type": "string",
"description": "The name of the Vite.js configuration file.",
Expand Down
9 changes: 9 additions & 0 deletions packages/vite/src/utils/generator-utils.ts
Expand Up @@ -138,6 +138,12 @@ export function addOrChangeBuildTarget(
};

if (targets[target]) {
buildOptions.fileReplacements = targets[target].options.fileReplacements;

if (target === '@nxext/vite:build') {
buildOptions.baseHref = targets[target].options.baseHref;
buildOptions.sourcemap = targets[target].options.sourcemaps;
}
targets[target].options = {
...buildOptions,
};
Expand Down Expand Up @@ -179,6 +185,9 @@ export function addOrChangeServeTarget(
};

if (targets[target]) {
if (target === '@nxext/vite:dev') {
serveOptions.proxyConfig = targets[target].options.proxyConfig;
}
targets[target].options = {
...serveOptions,
};
Expand Down

0 comments on commit 3ce4391

Please sign in to comment.