File tree Expand file tree Collapse file tree 5 files changed +11
-15
lines changed Expand file tree Collapse file tree 5 files changed +11
-15
lines changed Original file line number Diff line number Diff line change 1
- /* eslint-disable import/no-dynamic-require */
2
1
import assert from 'assert' ;
3
2
import { join } from 'path' ;
4
3
5
4
import * as fs from 'fs-extra' ;
6
5
7
- import { debounce } from 'lodash' ;
6
+ import debounce from 'lodash/debounce ' ;
8
7
import * as esbuild from 'esbuild' ;
9
8
10
9
import { Service } from './core' ;
Original file line number Diff line number Diff line change 1
- import ora from 'ora' ;
1
+ import ora , { Ora } from 'ora' ;
2
2
import type { ForegroundColor } from 'chalk' ;
3
3
import chalk from 'chalk' ;
4
4
@@ -21,7 +21,7 @@ function outputLogText(opts = {} as Partial<{ type: LogType; color: typeof Foreg
21
21
}
22
22
23
23
class Spinner {
24
- private spinnerInstance : ora . Ora | undefined ;
24
+ private spinnerInstance : Ora | undefined ;
25
25
26
26
init ( text = '即将开始启动自动生成业务配置代码,请稍等~\n' ) {
27
27
this . spinnerInstance = ora ( outputLogText ( ) ( text ) ) ;
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ export type Config = {
12
12
*/
13
13
loading ?: string ;
14
14
delay ?: number ;
15
- webpackPreload ?: boolean ;
16
15
} ;
17
16
// https://umijs.org/zh-CN/plugins/plugin-locale#umijsplugin-locale
18
17
locale ?: {
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ const PromiseWrapper = (cmdType: keyof typeof childProcess) => (
6
6
isConsoleLog = true ,
7
7
) =>
8
8
new Promise ( ( resolve , reject ) => {
9
- const result = childProcess [ cmdType ] ( options ) as childProcess . ChildProcessByStdio <
9
+ const result = childProcess [ cmdType as 'spawn' ] ( options ) as childProcess . ChildProcessByStdio <
10
10
Writable ,
11
11
Readable ,
12
12
Readable
Original file line number Diff line number Diff line change 1
- import type { Options as reactRefreshOptions } from '@vitejs/plugin-react-refresh' ;
2
- import reactRefresh from '@vitejs/plugin-react-refresh' ;
3
- import reactJsx from 'vite-react-jsx' ;
1
+ import react , { Options as ReactOptions } from '@vitejs/plugin-react'
4
2
import WindiCSS from 'vite-plugin-windicss' ;
5
3
6
4
import type { VitePluginOptions } from 'vite-plugin-style-import' ;
@@ -16,7 +14,7 @@ import { Bootstrap } from './Bootstrap';
16
14
17
15
type Options = {
18
16
styleImport ?: VitePluginOptions ;
19
- reactRefresh ?: reactRefreshOptions ;
17
+ react ?: ReactOptions ;
20
18
mkcert ?: ViteCertificateOptions ;
21
19
} ;
22
20
@@ -28,15 +26,15 @@ export const reactAutoConfig = async (options: Options = {}) => {
28
26
29
27
const { userConfig } = bootstrap . getServer ( ) ;
30
28
31
- const plugins = [ reactJsx ( ) , reactAutoConfigPluginConfig ( bootstrap ) ] as (
29
+ const plugins = [
30
+ // todo: 待替换成 https://github.com/iheyunfei/vite-on-swc
31
+ react ( options . react ) ,
32
+ reactAutoConfigPluginConfig ( bootstrap )
33
+ ] as (
32
34
| PluginOption
33
35
| PluginOption [ ]
34
36
) [ ] ;
35
37
36
- if ( userConfig . fastRefresh !== false ) {
37
- plugins . push ( reactRefresh ( options . reactRefresh ) ) ;
38
- }
39
-
40
38
if ( userConfig . antd ) {
41
39
const { styleImport } = options ;
42
40
You can’t perform that action at this time.
0 commit comments