From aec267f83ff0486b78f3b33f97b8608fc4e1833f Mon Sep 17 00:00:00 2001 From: winixt Date: Thu, 24 Nov 2022 14:54:22 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20viteLegacy=20?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/commands/build/getBuildConfig.js | 1 + packages/fes-template-h5/.fes.js | 58 ++++++++++--------- packages/fes-template-h5/.fes.prod.js | 7 +-- packages/fes-template-h5/package.json | 6 +- packages/fes-template-h5/src/app.js | 2 +- 5 files changed, 37 insertions(+), 37 deletions(-) diff --git a/packages/fes-builder-vite/src/commands/build/getBuildConfig.js b/packages/fes-builder-vite/src/commands/build/getBuildConfig.js index 60a7c68e..14aeea66 100644 --- a/packages/fes-builder-vite/src/commands/build/getBuildConfig.js +++ b/packages/fes-builder-vite/src/commands/build/getBuildConfig.js @@ -37,6 +37,7 @@ export default async (api) => { modernPolyfills: true, renderLegacyChunks: false, targets, + ...api.config.viteLegacy, }), splitVendorChunkPlugin(), ], diff --git a/packages/fes-template-h5/.fes.js b/packages/fes-template-h5/.fes.js index d3755d4b..99ba7490 100644 --- a/packages/fes-template-h5/.fes.js +++ b/packages/fes-template-h5/.fes.js @@ -5,33 +5,39 @@ import { defineBuildConfig } from '@fesjs/fes'; export default defineBuildConfig({ proxy: { '/v2': { - 'target': 'https://api.douban.com/', - 'changeOrigin': true, - } + target: 'https://api.douban.com/', + changeOrigin: true, + }, }, publicPath: '/', - html: { - title: '拉夫德鲁' + viteOption: { + css: { + postcss: { + plugins: [ + pxtoviewport({ + unitToConvert: 'px', + viewportWidth: 375, + unitPrecision: 5, + propList: ['*'], + viewportUnit: 'vw', + fontViewportUnit: 'vw', + selectorBlackList: [], + minPixelValue: 1, + mediaQuery: false, + replace: true, + exclude: [], + landscape: false, + landscapeUnit: 'vw', + }), + ], + }, + }, + build: { + target: 'es2015', + }, + }, + targets: { + chrome: 61, + ios: 11, }, - extraPostCSSPlugins: [ - pxtoviewport({ - unitToConvert: 'px', - viewportWidth: 375, - unitPrecision: 5, - propList: ['*'], - viewportUnit: 'vw', - fontViewportUnit: 'vw', - selectorBlackList: [], - minPixelValue: 1, - mediaQuery: false, - replace: true, - exclude: [], - landscape: false, - landscapeUnit: 'vw' - }) - ], - devServer: { - port: 8000 - } }); - diff --git a/packages/fes-template-h5/.fes.prod.js b/packages/fes-template-h5/.fes.prod.js index 0f64aa6a..aad6bee4 100644 --- a/packages/fes-template-h5/.fes.prod.js +++ b/packages/fes-template-h5/.fes.prod.js @@ -1,8 +1,3 @@ // .fes.js 只负责管理编译时配置,只能使用plain Object - -export default { - request: { - base: '/api' - } -}; +export default {}; diff --git a/packages/fes-template-h5/package.json b/packages/fes-template-h5/package.json index 0cfe49d3..6b5736bb 100644 --- a/packages/fes-template-h5/package.json +++ b/packages/fes-template-h5/package.json @@ -39,14 +39,12 @@ "publishConfig": { "access": "public" }, - "devDependencies": { - "@ttou/postcss-px-to-viewport": "1.1.4" - }, "dependencies": { + "@ttou/postcss-px-to-viewport": "1.1.4", "@fesjs/fes": "^3.0.0-rc.0", "@fesjs/plugin-icon": "^3.0.0-rc.0", "@fesjs/plugin-request": "^3.0.0-rc.0", - "@fesjs/builder-webpack": "^3.0.0-rc.0", + "@fesjs/builder-vite": "^3.0.0-rc.1", "vue": "^3.2.37" }, "private": true diff --git a/packages/fes-template-h5/src/app.js b/packages/fes-template-h5/src/app.js index fd26745d..c20a9277 100644 --- a/packages/fes-template-h5/src/app.js +++ b/packages/fes-template-h5/src/app.js @@ -1,7 +1,7 @@ import { defineRuntimeConfig } from '@fesjs/fes'; export default defineRuntimeConfig({ - request: {}, + // request: {}, }); // export default defineRuntimeConfig({