Skip to content

Commit

Permalink
fix(bundling): remove default values from executors
Browse files Browse the repository at this point in the history
ISSUES CLOSED: #13350
  • Loading branch information
mandarini committed Nov 28, 2022
1 parent 9703515 commit 5526c31
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 38 deletions.
26 changes: 5 additions & 21 deletions docs/generated/packages/vite.json
Expand Up @@ -161,29 +161,18 @@
"description": "Path to the proxy configuration file.",
"x-completion-type": "file"
},
"port": {
"type": "number",
"description": "Port to listen on.",
"default": 4200
},
"port": { "type": "number", "description": "Port to listen on." },
"host": {
"description": "Specify which IP addresses the server should listen on.",
"default": "localhost",
"oneOf": [{ "type": "boolean" }, { "type": "string" }]
},
"https": {
"type": "boolean",
"description": "Serve using HTTPS.",
"default": false
},
"https": { "type": "boolean", "description": "Serve using HTTPS." },
"hmr": {
"description": "Enable hot module replacement. For more options, use the 'hmr' option in the Vite configuration file.",
"type": "boolean",
"default": true
"type": "boolean"
},
"open": {
"description": "Automatically open the app in the browser on server start. When the value is a string, it will be used as the URL's pathname.",
"default": false,
"oneOf": [{ "type": "boolean" }, { "type": "string" }]
},
"cors": {
Expand All @@ -198,12 +187,10 @@
"mode": {
"type": "string",
"description": "Mode to run the server in.",
"enum": ["production", "development"],
"default": "development"
"enum": ["production", "development"]
},
"clearScreen": {
"description": "Set to false to prevent Vite from clearing the terminal screen when logging certain messages.",
"default": true,
"type": "boolean"
}
},
Expand Down Expand Up @@ -312,12 +299,10 @@
},
"sourcemap": {
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
"default": true,
"oneOf": [{ "type": "boolean" }, { "type": "string" }]
},
"minify": {
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
"default": "esbuild",
"oneOf": [{ "type": "boolean" }, { "type": "string" }]
},
"manifest": {
Expand All @@ -336,8 +321,7 @@
"mode": {
"type": "string",
"description": "Mode to run the build in.",
"enum": ["production", "development"],
"default": "production"
"enum": ["production", "development"]
}
},
"definitions": {
Expand Down
5 changes: 1 addition & 4 deletions packages/vite/src/executors/build/schema.json
Expand Up @@ -70,7 +70,6 @@
},
"sourcemap": {
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
"default": true,
"oneOf": [
{
"type": "boolean"
Expand All @@ -82,7 +81,6 @@
},
"minify": {
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
"default": "esbuild",
"oneOf": [
{
"type": "boolean"
Expand Down Expand Up @@ -122,8 +120,7 @@
"mode": {
"type": "string",
"description": "Mode to run the build in.",
"enum": ["production", "development"],
"default": "production"
"enum": ["production", "development"]
}
},
"definitions": {
Expand Down
15 changes: 4 additions & 11 deletions packages/vite/src/executors/dev-server/schema.json
Expand Up @@ -27,12 +27,10 @@
},
"port": {
"type": "number",
"description": "Port to listen on.",
"default": 4200
"description": "Port to listen on."
},
"host": {
"description": "Specify which IP addresses the server should listen on.",
"default": "localhost",
"oneOf": [
{
"type": "boolean"
Expand All @@ -44,17 +42,14 @@
},
"https": {
"type": "boolean",
"description": "Serve using HTTPS.",
"default": false
"description": "Serve using HTTPS."
},
"hmr": {
"description": "Enable hot module replacement. For more options, use the 'hmr' option in the Vite configuration file.",
"type": "boolean",
"default": true
"type": "boolean"
},
"open": {
"description": "Automatically open the app in the browser on server start. When the value is a string, it will be used as the URL's pathname.",
"default": false,
"oneOf": [
{
"type": "boolean"
Expand All @@ -76,12 +71,10 @@
"mode": {
"type": "string",
"description": "Mode to run the server in.",
"enum": ["production", "development"],
"default": "development"
"enum": ["production", "development"]
},
"clearScreen": {
"description": "Set to false to prevent Vite from clearing the terminal screen when logging certain messages.",
"default": true,
"type": "boolean"
}
},
Expand Down
15 changes: 14 additions & 1 deletion packages/vite/src/utils/generator-utils.ts
Expand Up @@ -388,6 +388,7 @@ export function writeViteConfig(tree: Tree, options: Schema) {
// Configuration for building your library.
// See: https://vitejs.dev/guide/build.html#library-mode
build: {
mode: 'production',
lib: {
// Could also be a dictionary or array of multiple entry points.
entry: 'src/index.ts',
Expand All @@ -406,7 +407,17 @@ export function writeViteConfig(tree: Tree, options: Schema) {
}]
}
},`
: '';
: `
build: {
mode: 'production',
},`;

const serverOption = `
server:{
port: 4200,
mode: 'development',
host: 'localhost',
},`;

switch (options.uiFramework) {
case 'react':
Expand All @@ -422,6 +433,7 @@ ${options.includeVitest ? '/// <reference types="vitest" />' : ''}
}
export default defineConfig({
${serverOption}
plugins: [
${options.includeLib ? dtsPlugin : ''}
react(),
Expand All @@ -447,6 +459,7 @@ ${options.includeVitest ? '/// <reference types="vitest" />' : ''}
}
export default defineConfig({
${serverOption}
plugins: [
${options.includeLib ? dtsPlugin : ''}
tsconfigPaths({
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/utils/options-utils.ts
Expand Up @@ -79,7 +79,7 @@ export async function getUserConfig(
): Promise<UserConfig> {
const baseUserConfig: UserConfigFn = (await defineConfig(() => {
return {
base: options.baseHref ?? '/',
base: options.baseHref ?? undefined,
root: projectRoot,
tsConfig: normalizeTsConfigPath(options.tsConfig, context.root),
};
Expand Down

0 comments on commit 5526c31

Please sign in to comment.