@seayoo-web/scripts 3.0.3 → 3.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -242,27 +242,29 @@ function definePageBuildConfig(option) {
242
242
  },
243
243
  plugins: [
244
244
  preset.ignoreVuePlugin ? null : vue(),
245
- preset.ignorePolyfill ? null : legacy({
246
- targets: ["defaults", "> 0.1%", "last 5 versions and not dead"],
247
- // https://github.com/vitejs/vite/blob/main/packages/plugin-legacy/src/index.ts#L170
248
- // https://unpkg.com/browse/core-js@3.41.0/
249
- additionalLegacyPolyfills: [
250
- "regenerator-runtime/runtime",
251
- "core-js/es/global-this",
252
- "core-js/es/array/flat",
253
- "core-js/es/array/flat-map",
254
- "core-js/es/promise/all-settled",
255
- "core-js/es/promise/any",
256
- "core-js/es/symbol/iterator"
257
- ],
258
- additionalModernPolyfills: [
259
- "core-js/es/array/flat",
260
- "core-js/es/array/flat-map",
261
- "core-js/es/promise/all-settled",
262
- "core-js/es/promise/any",
263
- "core-js/es/symbol/iterator"
264
- ]
265
- }),
245
+ preset.ignorePolyfill ? null : legacy(
246
+ preset.polyfill ?? {
247
+ targets: ["defaults", "> 0.1%", "last 5 versions and not dead"],
248
+ // https://github.com/vitejs/vite/blob/main/packages/plugin-legacy/src/index.ts#L170
249
+ // https://unpkg.com/browse/core-js@3.41.0/
250
+ additionalLegacyPolyfills: [
251
+ "regenerator-runtime/runtime",
252
+ "core-js/es/global-this",
253
+ "core-js/es/array/flat",
254
+ "core-js/es/array/flat-map",
255
+ "core-js/es/promise/all-settled",
256
+ "core-js/es/promise/any",
257
+ "core-js/es/symbol/iterator"
258
+ ],
259
+ additionalModernPolyfills: [
260
+ "core-js/es/array/flat",
261
+ "core-js/es/array/flat-map",
262
+ "core-js/es/promise/all-settled",
263
+ "core-js/es/promise/any",
264
+ "core-js/es/symbol/iterator"
265
+ ]
266
+ }
267
+ ),
266
268
  htmlInjectPlugin({
267
269
  BUILD_TIME: envs.stamp,
268
270
  BUILD_MODE: envs.mode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seayoo-web/scripts",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "scripts for seayoo web repos",
5
5
  "type": "module",
6
6
  "source": "index.ts",
@@ -1,3 +1,4 @@
1
+ import type { Options } from "@vitejs/plugin-legacy";
1
2
  import type { UserConfig, UserConfigFnPromise } from "vite";
2
3
  interface ExternalConfig {
3
4
  /**
@@ -20,6 +21,10 @@ interface ExternalConfig {
20
21
  * 是否忽略 polyfill
21
22
  */
22
23
  ignorePolyfill?: boolean;
24
+ /**
25
+ * 自定义 polyfill
26
+ */
27
+ polyfill?: Options;
23
28
  /**
24
29
  * 指定哪些不够友好的包,这些包的 iife 或修改全局 windows 变量的行为导致默认 tree-shaking 策略失效
25
30
  *