diff --git a/packages/fes-builder-vite/src/common/getConfig.js b/packages/fes-builder-vite/src/common/getConfig.js index a6c2099a..a434bc86 100644 --- a/packages/fes-builder-vite/src/common/getConfig.js +++ b/packages/fes-builder-vite/src/common/getConfig.js @@ -36,19 +36,24 @@ export function getInnerCommonConfig(api) { vue(api.config.viteVuePlugin || {}), SFCConfigBlockPlugin, vueJsx(api.config.viteVueJsx || {}), - createHtmlPlugin({ - minify: true, - // 使用绝对地址在win下会提示没有权限 - entry: `/src/${api.paths.tmpDir}/fes.js`, - template: 'index.html', - inject: { - data: { - ...resolveRuntimeEnv(publicPath), - title: api.config.title || 'Fes.js', - mountElementId: api.config.mountElementId, + createHtmlPlugin( + deepmerge( + { + minify: true, + // 使用绝对地址在win下会提示没有权限 + entry: `/src/${api.paths.tmpDir}/fes.js`, + template: 'index.html', + inject: { + data: { + ...resolveRuntimeEnv(publicPath), + title: api.config.title || 'Fes.js', + mountElementId: api.config.mountElementId, + }, + }, }, - }, - }), + api.config.viteHtml, + ), + ), ], resolve: { alias: { diff --git a/packages/fes-builder-vite/src/index.js b/packages/fes-builder-vite/src/index.js index ddf09b18..e2bf8559 100644 --- a/packages/fes-builder-vite/src/index.js +++ b/packages/fes-builder-vite/src/index.js @@ -6,6 +6,7 @@ export default function () { require.resolve('./registerType'), // bundle configs + require.resolve('./features/viteHtml'), require.resolve('./features/viteOption'), require.resolve('./features/viteVueJsx'), require.resolve('./features/viteVuePlugin'), diff --git a/packages/fes-builder-webpack/package.json b/packages/fes-builder-webpack/package.json index 7003e4ee..01399089 100644 --- a/packages/fes-builder-webpack/package.json +++ b/packages/fes-builder-webpack/package.json @@ -32,7 +32,7 @@ "@babel/plugin-proposal-function-bind": "^7.18.9", "@babel/plugin-proposal-pipeline-operator": "^7.18.9", "@babel/plugin-transform-runtime": "^7.21.0", - "@babel/preset-env": "^7.20.2", + "@babel/preset-env": "7.20.2", "@babel/preset-typescript": "^7.21.0", "@fesjs/utils": "^3.0.0", "@vue/babel-plugin-jsx": "^1.1.1", diff --git a/packages/fes-template-vite/.fes.js b/packages/fes-template-vite/.fes.js index 546447c1..b54cd286 100644 --- a/packages/fes-template-vite/.fes.js +++ b/packages/fes-template-vite/.fes.js @@ -1,7 +1,7 @@ import { defineBuildConfig } from '@fesjs/fes'; export default defineBuildConfig({ - builder: 'webpack', + builder: 'vite', define: { __DEV__: false, }, @@ -71,6 +71,9 @@ export default defineBuildConfig({ ['1', '有效的'], ], }, + viteHtml: { + template: 'hello.html', + }, dynamicImport: true, monacoEditor: { languages: ['javascript', 'typescript', 'html', 'json'], diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f05a785d..28085302 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -193,7 +193,7 @@ importers: specifier: ^7.21.0 version: 7.21.0(@babel/core@7.21.3) '@babel/preset-env': - specifier: ^7.20.2 + specifier: 7.20.2 version: 7.20.2(@babel/core@7.21.3) '@babel/preset-typescript': specifier: ^7.21.0