Skip to content

Commit

Permalink
perf!: disable polyfill injection by default (#2804)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan authored Jul 5, 2024
1 parent aeb609e commit 4e42c74
Show file tree
Hide file tree
Showing 19 changed files with 79 additions and 343 deletions.
19 changes: 0 additions & 19 deletions packages/compat/plugin-swc/tests/__snapshots__/plugin.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ exports[`plugin-swc > should apply multiple environment configs correctly 1`] =
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -73,7 +72,6 @@ exports[`plugin-swc > should apply multiple environment configs correctly 1`] =
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -130,7 +128,6 @@ exports[`plugin-swc > should apply multiple environment configs correctly 1`] =
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"node >= 16",
],
Expand Down Expand Up @@ -187,7 +184,6 @@ exports[`plugin-swc > should apply multiple environment configs correctly 1`] =
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"node >= 16",
],
Expand Down Expand Up @@ -246,7 +242,6 @@ exports[`plugin-swc > should apply source.include and source.exclude correctly 1
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -305,7 +300,6 @@ exports[`plugin-swc > should apply source.include and source.exclude correctly 1
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -364,7 +358,6 @@ exports[`plugin-swc > should disable react refresh when dev.hmr is false 1`] = `
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -423,7 +416,6 @@ exports[`plugin-swc > should disable react refresh when dev.hmr is false 1`] = `
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -481,7 +473,6 @@ exports[`plugin-swc > should disable react refresh when target is not web 1`] =
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"node >= 16",
],
Expand Down Expand Up @@ -537,7 +528,6 @@ exports[`plugin-swc > should disable react refresh when target is not web 1`] =
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"node >= 16",
],
Expand Down Expand Up @@ -592,7 +582,6 @@ exports[`plugin-swc > should disable react refresh when target is not web 2`] =
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -651,7 +640,6 @@ exports[`plugin-swc > should disable react refresh when target is not web 2`] =
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -709,7 +697,6 @@ exports[`plugin-swc > should disable react refresh when target is not web 3`] =
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -768,7 +755,6 @@ exports[`plugin-swc > should disable react refresh when target is not web 3`] =
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -879,7 +865,6 @@ exports[`plugin-swc > should set multiple swc-loader 1`] = `
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -931,7 +916,6 @@ exports[`plugin-swc > should set multiple swc-loader 1`] = `
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -991,7 +975,6 @@ exports[`plugin-swc > should set multiple swc-loader 1`] = `
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -1076,7 +1059,6 @@ exports[`plugin-swc > should set swc-loader 1`] = `
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -1135,7 +1117,6 @@ exports[`plugin-swc > should set swc-loader 1`] = `
"cwd": "<ROOT>/packages/compat/plugin-swc/tests",
"env": {
"coreJs": "3.37",
"mode": "usage",
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down
10 changes: 0 additions & 10 deletions packages/compat/webpack/tests/__snapshots__/default.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly 1`] = `
"priority": 0,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]lodash\\(-es\\)\\?\\[\\\\\\\\/\\]/,
},
"lib-polyfill": {
"name": "lib-polyfill",
"priority": 0,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(\\?:tslib\\|core-js\\|@swc\\[\\\\\\\\/\\]helpers\\)\\[\\\\\\\\/\\]/,
},
},
"chunks": "all",
"enforceSizeThreshold": 50000,
Expand Down Expand Up @@ -672,11 +667,6 @@ exports[`applyDefaultPlugins > should apply default plugins correctly when produ
"priority": 0,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]lodash\\(-es\\)\\?\\[\\\\\\\\/\\]/,
},
"lib-polyfill": {
"name": "lib-polyfill",
"priority": 0,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(\\?:tslib\\|core-js\\|@swc\\[\\\\\\\\/\\]helpers\\)\\[\\\\\\\\/\\]/,
},
},
"chunks": "all",
"enforceSizeThreshold": 50000,
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const getDefaultOutputConfig = (): NormalizedOutputConfig => ({
assetPrefix: DEFAULT_ASSET_PREFIX,
filename: {},
charset: 'ascii',
polyfill: 'usage',
polyfill: 'off',
dataUriLimit: {
svg: DEFAULT_DATA_URL_SIZE,
font: DEFAULT_DATA_URL_SIZE,
Expand Down
21 changes: 2 additions & 19 deletions packages/core/tests/__snapshots__/builder.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -98,21 +98,14 @@ exports[`should use rspack as default bundler > apply rspack correctly 1`] = `
},
/\\\\\\.\\(\\?:ts\\|tsx\\|jsx\\|mts\\|cts\\)\\$/,
],
"resolve": {
"alias": {
"core-js": "<ROOT>/node_modules/<PNPM_INNER>/core-js",
},
},
"test": /\\\\\\.\\(\\?:js\\|jsx\\|mjs\\|cjs\\|ts\\|tsx\\|mts\\|cts\\)\\$/,
"type": "javascript/auto",
"use": [
{
"loader": "builtin:swc-loader",
"options": {
"env": {
"coreJs": "3.37",
"mode": "usage",
"shippedProposals": true,
"mode": undefined,
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -146,19 +139,14 @@ exports[`should use rspack as default bundler > apply rspack correctly 1`] = `
],
},
"resolve": {
"alias": {
"core-js": "<ROOT>/node_modules/<PNPM_INNER>/core-js",
},
"fullySpecified": false,
},
"use": [
{
"loader": "builtin:swc-loader",
"options": {
"env": {
"coreJs": "3.37",
"mode": "usage",
"shippedProposals": true,
"mode": undefined,
"targets": [
"chrome >= 87",
"edge >= 88",
Expand Down Expand Up @@ -317,11 +305,6 @@ exports[`should use rspack as default bundler > apply rspack correctly 1`] = `
"priority": 0,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]lodash\\(-es\\)\\?\\[\\\\\\\\/\\]/,
},
"lib-polyfill": {
"name": "lib-polyfill",
"priority": 0,
"test": /\\[\\\\\\\\/\\]node_modules\\[\\\\\\\\/\\]\\(\\?:tslib\\|core-js\\|@swc\\[\\\\\\\\/\\]helpers\\)\\[\\\\\\\\/\\]/,
},
},
"chunks": "all",
"enforceSizeThreshold": 50000,
Expand Down
Loading

0 comments on commit 4e42c74

Please sign in to comment.