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-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'],