diff --git a/packages/create-fes-app/templates/plugin/scripts/compiler.js b/packages/create-fes-app/templates/plugin/scripts/compiler.js index 2d142b71..ee1aeb09 100644 --- a/packages/create-fes-app/templates/plugin/scripts/compiler.js +++ b/packages/create-fes-app/templates/plugin/scripts/compiler.js @@ -32,7 +32,7 @@ function transformBrowserCode(code) { { modules: false, useBuiltIns: false, - targets: { chrome: '51' }, + targets: { chrome: '64' }, }, ], ], diff --git a/packages/fes-builder-vite/src/commands/build/getBuildConfig.js b/packages/fes-builder-vite/src/commands/build/getBuildConfig.js index 51096c0a..60a7c68e 100644 --- a/packages/fes-builder-vite/src/commands/build/getBuildConfig.js +++ b/packages/fes-builder-vite/src/commands/build/getBuildConfig.js @@ -1,6 +1,17 @@ +import { splitVendorChunkPlugin } from 'vite'; import legacy from '@vitejs/plugin-legacy'; import { getInnerCommonConfig } from '../../common/getConfig'; +function getEsbuildTarget(targets) { + const result = []; + ['chrome', 'edge', 'firefox', 'hermes', 'ios', 'node', 'opera', 'rhino', 'safari'].forEach((key) => { + if (targets[key]) { + result.push(`${key}${targets[key]}`); + } + }); + return result; +} + export default async (api) => { const { deepmerge, getTargetsAndBrowsersList } = api.utils; @@ -24,14 +35,15 @@ export default async (api) => { plugins: [ legacy({ modernPolyfills: true, + renderLegacyChunks: false, targets, }), + splitVendorChunkPlugin(), ], build: { ...build, - minify: 'terser', terserOptions: build.terserOptions || api.config.terserOptions, - target: build.target || 'es2015', + target: build.target || getEsbuildTarget(targets), outDir: build.outDir || api.config.outputPath || 'dist', assetsInlineLimit: build.assetsInlineLimit || api.config.inlineLimit || 8192, }, diff --git a/packages/fes-preset-built-in/src/plugins/features/targets.js b/packages/fes-preset-built-in/src/plugins/features/targets.js index 03b6ddd5..5fc55100 100644 --- a/packages/fes-preset-built-in/src/plugins/features/targets.js +++ b/packages/fes-preset-built-in/src/plugins/features/targets.js @@ -3,10 +3,16 @@ export default (api) => { key: 'targets', config: { default: { - chrome: 56, - firefox: 67, - safari: 10, - edge: 13, + android: '61.0.0', + chrome: '61.0.0', + edge: '16.0.0', + firefox: '60.0.0', + ios: '10.3.0', + node: '13.2.0', + opera: '48.0.0', + safari: '10.1.0', + samsung: '8.2.0', + browsers: ['defaults and not chrome < 61'], }, schema(joi) { return joi.object();