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!: remove deprecated dev.startUrl #2642

Merged
merged 2 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all 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 packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ const getDefaultDevConfig = (): NormalizedDevConfig => ({
hmr: true,
liveReload: true,
assetPrefix: DEFAULT_ASSET_PREFIX,
startUrl: false,
writeToDisk: false,
client: {
path: HMR_SOCKET_PATH,
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/mergeConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const OVERRIDE_PATH = [
'output.emitAssets',
'server.open',
'server.printUrls',
'dev.startUrl',
'provider',
];

Expand Down
9 changes: 4 additions & 5 deletions packages/core/src/plugins/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,19 @@ const openedURLs: string[] = [];
const normalizeOpenConfig = (
config: NormalizedConfig,
): { targets?: string[]; before?: () => Promise<void> | void } => {
const open = config.server.open || config.dev.startUrl;
const { beforeStartUrl } = config.dev;
const { open } = config.server;

if (open === false) {
return {};
}
if (open === true) {
return { targets: [], before: beforeStartUrl };
return { targets: [] };
}
if (typeof open === 'string') {
return { targets: [open], before: beforeStartUrl };
return { targets: [open] };
}
if (Array.isArray(open)) {
return { targets: open, before: beforeStartUrl };
return { targets: open };
}

return {
Expand Down
6 changes: 0 additions & 6 deletions packages/core/tests/__snapshots__/environments.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ exports[`environment config > should normalize environment config correctly 1`]
},
"hmr": true,
"liveReload": true,
"startUrl": false,
"writeToDisk": false,
},
"html": {
Expand Down Expand Up @@ -136,7 +135,6 @@ exports[`environment config > should print environment config when inspect confi
},
"hmr": true,
"liveReload": true,
"startUrl": false,
"writeToDisk": false,
},
"html": {
Expand Down Expand Up @@ -256,7 +254,6 @@ exports[`environment config > should print environment config when inspect confi
},
"hmr": true,
"liveReload": true,
"startUrl": false,
"writeToDisk": false,
},
"html": {
Expand Down Expand Up @@ -381,7 +378,6 @@ exports[`environment config > should support modify environment config by api.mo
},
"hmr": true,
"liveReload": true,
"startUrl": false,
"writeToDisk": false,
},
"html": {
Expand Down Expand Up @@ -501,7 +497,6 @@ exports[`environment config > should support modify environment config by api.mo
},
"hmr": true,
"liveReload": true,
"startUrl": false,
"writeToDisk": false,
},
"html": {
Expand Down Expand Up @@ -622,7 +617,6 @@ exports[`environment config > should support modify environment config by api.mo
},
"hmr": true,
"liveReload": true,
"startUrl": false,
"writeToDisk": false,
},
"html": {
Expand Down
17 changes: 1 addition & 16 deletions packages/shared/src/types/config/dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,6 @@ export interface DevConfig {
* Whether to reload the page when file changes are detected.
*/
liveReload?: boolean;
/**
* Set the page URL to open when the server starts.
* @deprecated use `server.open` instead
*/
startUrl?: boolean | string | string[];
/**
* Execute a callback function before opening the `startUrl`.
* @deprecated use `server.open.before` instead.
*/
beforeStartUrl?: () => Promise<void> | void;
/**
* Set the URL prefix of static assets during development,
* similar to the [output.publicPath](https://rspack.dev/config/output#outputpublicpath) config of webpack.
Expand Down Expand Up @@ -98,11 +88,6 @@ export type NormalizedDevConfig = DevConfig &
Required<
Pick<
DevConfig,
| 'hmr'
| 'client'
| 'startUrl'
| 'liveReload'
| 'assetPrefix'
| 'writeToDisk'
'hmr' | 'client' | 'liveReload' | 'assetPrefix' | 'writeToDisk'
>
>;
Loading