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: upgrade vite dependencies to v4.1 #10337

Merged
merged 9 commits into from Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/test-vitest/package.json
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"@types/react-test-renderer": "^18.0.0",
"@vitejs/plugin-react": "1.2.0",
"@vitejs/plugin-react": "3.0.1",
"react-test-renderer": "^18.2.0",
"typescript": "^4.9.4",
"vitest": "^0.16.0"
Expand Down
123,281 changes: 123,281 additions & 0 deletions packages/bundler-vite/compiled/@vitejs/plugin-legacy/346.index.cjs.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

@@ -1 +1 @@
{"name":"@vitejs/plugin-legacy","version":"2.3.1","author":"Evan You","license":"MIT","types":"./dist/index.d.ts"}
{"name":"@vitejs/plugin-legacy","version":"3.0.2","author":"Evan You","license":"MIT","types":"./dist/index.d.ts"}
9 changes: 5 additions & 4 deletions packages/bundler-vite/package.json
Expand Up @@ -28,18 +28,19 @@
"@svgr/core": "6.2.1",
"@umijs/bundler-utils": "4.0.47",
"@umijs/utils": "4.0.47",
"@vitejs/plugin-react": "2.2.0",
"@vitejs/plugin-react": "3.0.1",
"core-js": "^3.27.2",
fz6m marked this conversation as resolved.
Show resolved Hide resolved
"less": "4.1.3",
"postcss-preset-env": "7.5.0",
"rollup-plugin-visualizer": "5.9.0",
"vite": "3.2.5"
"vite": "4.0.4"
},
"devDependencies": {
"@types/caniuse-lite": "1.0.1",
"@types/svgo": "3.0.0",
"@vitejs/plugin-legacy": "2.3.1",
"@vitejs/plugin-legacy": "3.0.2",
"caniuse-lite": "1.0.30001441",
"rollup": "2.79.1",
"rollup": "3.7.0",
"rollup-plugin-copy": "3.4.0"
},
"publishConfig": {
Expand Down
5 changes: 4 additions & 1 deletion packages/bundler-vite/src/config/transformer/rollup.ts
@@ -1,11 +1,11 @@
import type { IConfig } from '@umijs/bundler-webpack/dist/types';
import path from 'path';
import {
visualizer,
type PluginVisualizerOptions,
} from 'rollup-plugin-visualizer';
import type { IConfigProcessor } from '.';
import copy from '../../../compiled/rollup-plugin-copy';
import type { IConfig } from '@umijs/bundler-webpack/dist/types';

/**
* transform umi configs to vite rollup options
Expand Down Expand Up @@ -51,6 +51,8 @@ export default (function rollup(userConfig) {
})
);
}

// @ts-ignore
config.build!.rollupOptions!.plugins!.push(
visualizer({
template: generateStatsFile ? 'raw-data' : 'treemap',
Expand All @@ -67,6 +69,7 @@ export default (function rollup(userConfig) {

// handle copy
if (Array.isArray(userConfig.copy)) {
// @ts-ignore rollup 升级导致的类型不正确, 这里的用法没问题
config.build!.rollupOptions!.plugins!.push(
copy({
targets: userConfig.copy.map((item) => {
Expand Down
1 change: 1 addition & 0 deletions packages/bundler-vite/src/config/transformer/target.ts
Expand Up @@ -39,6 +39,7 @@ export default (function target(userConfig) {
targets: getBrowserlist(userConfig.targets),
polyfills: false,
ignoreBrowserslistConfig: true,
externalSystemJS: true,
};

config.plugins!.push(legacyPlugin(legacyOpts));
Expand Down
2 changes: 1 addition & 1 deletion packages/preset-umi/package.json
Expand Up @@ -67,7 +67,7 @@
"multer": "1.4.4",
"os-locale": "^6.0.2",
"sirv": "2.0.2",
"vite": "2.9.1"
"vite": "4.0.4"
},
"publishConfig": {
"access": "public"
Expand Down
4 changes: 2 additions & 2 deletions packages/preset-umi/src/features/esmi/esmi.ts
@@ -1,7 +1,7 @@
import { parse as parseImports } from '@umijs/bundler-utils/compiled/es-module-lexer';
import MagicString from 'magic-string';
import { join } from 'path';
import type { Plugin, ResolvedConfig } from 'vite';
import type { HmrContext, Plugin, ResolvedConfig } from 'vite';
import { createResolver } from '../../libs/scan';
import type { IApi } from '../../types';
import requireToImport from './esbuildPlugins/requireToImport';
Expand All @@ -15,7 +15,7 @@ let importmatches: Record<string, string> = {};
* esmi vite plugin
*/
function esmi(opts: {
handleHotUpdate?: Plugin['handleHotUpdate'];
handleHotUpdate?: (ctx: HmrContext) => void;
resolver: ReturnType<typeof createResolver>;
}): Plugin {
return {
Expand Down
2 changes: 1 addition & 1 deletion packages/preset-vue/compiled/@vitejs/plugin-vue/index.js

Large diffs are not rendered by default.

@@ -1 +1 @@
{"name":"@vitejs/plugin-vue","version":"3.2.0","author":"Evan You","license":"MIT","types":"./dist/index.d.ts"}
{"name":"@vitejs/plugin-vue","version":"4.0.0","author":"Evan You","license":"MIT","types":"./dist/index.d.ts"}
2 changes: 1 addition & 1 deletion packages/preset-vue/package.json
Expand Up @@ -28,7 +28,7 @@
"vue-router": "4.1.6"
},
"devDependencies": {
"@vitejs/plugin-vue": "2.3.1",
"@vitejs/plugin-vue": "4.0.0",
"umi": "4.0.47"
},
"publishConfig": {
Expand Down