From 8d113e7e3d93ec05739f6ee2173bf633be1cc31b Mon Sep 17 00:00:00 2001 From: kazuya kawaguchi Date: Sun, 1 May 2022 23:25:18 +0900 Subject: [PATCH] improvement: esm-bundler warning bring from: #461 #514 #583 resolve: #810 --- docs/guide/advanced/optimization.md | 1 - jest.config.js | 3 +-- packages/global.d.ts | 1 - packages/size-check-vue-i18n/rollup.config.js | 1 - packages/vue-i18n/README.md | 5 ----- packages/vue-i18n/src/misc.ts | 9 --------- rollup.config.js | 3 +-- 7 files changed, 2 insertions(+), 21 deletions(-) diff --git a/docs/guide/advanced/optimization.md b/docs/guide/advanced/optimization.md index d53ec292e..edcc02738 100644 --- a/docs/guide/advanced/optimization.md +++ b/docs/guide/advanced/optimization.md @@ -93,7 +93,6 @@ The `esm-bundler` builds now exposes global feature flags that can be overwritte - `__VUE_I18N_FULL_INSTALL__` (enable/disable, in addition to vue-i18n APIs, components and directives all fully support installation: `true`) - `__VUE_I18N_LEGACY_API__` (enable/disable vue-i18n legacy style APIs support, default: `true`) -- `__VUE_I18N_PROD_DEVTOOLS__` (enable/disable vue-devtools support in production, default: `false`) - `__INTLIFY_PROD_DEVTOOLS__` (enable/disable `@intlify/devtools` support in production, default: `false`) :::warning NOTICE diff --git a/jest.config.js b/jest.config.js index 200f01aa5..8595eafe9 100644 --- a/jest.config.js +++ b/jest.config.js @@ -72,8 +72,7 @@ module.exports = { __ESM_BROWSER__: false, __NODE_JS__: true, __FEATURE_FULL_INSTALL__: true, - __FEATURE_LEGACY_API__: true, - __FEATURE_ESM_BUNDLER_WARN__: true + __FEATURE_LEGACY_API__: true }, // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. diff --git a/packages/global.d.ts b/packages/global.d.ts index 5d695d751..e54bd9f1c 100644 --- a/packages/global.d.ts +++ b/packages/global.d.ts @@ -15,7 +15,6 @@ declare let __FEATURE_PROD_VUE_DEVTOOLS__: boolean declare let __FEATURE_PROD_INTLIFY_DEVTOOLS__: boolean declare let __FEATURE_LEGACY_API__: boolean declare let __FEATURE_FULL_INSTALL__: boolean -declare let __FEATURE_ESM_BUNDLER_WARN__: boolean // for tests declare namespace jest { diff --git a/packages/size-check-vue-i18n/rollup.config.js b/packages/size-check-vue-i18n/rollup.config.js index 3724d5c37..de1bd1fc3 100644 --- a/packages/size-check-vue-i18n/rollup.config.js +++ b/packages/size-check-vue-i18n/rollup.config.js @@ -28,7 +28,6 @@ const config = { __VUE_PROD_DEVTOOLS__: false, __VUE_I18N_LEGACY_API__: false, __VUE_I18N_FULL_INSTALL__: false, - __VUE_I18N_PROD_DEVTOOLS__: false, __INTLIFY_PROD_DEVTOOLS__: false, 'process.env.NODE_ENV': JSON.stringify('production') }), diff --git a/packages/vue-i18n/README.md b/packages/vue-i18n/README.md index d28b035a9..5aca13201 100644 --- a/packages/vue-i18n/README.md +++ b/packages/vue-i18n/README.md @@ -52,7 +52,6 @@ The `esm-bundler` builds now exposes global feature flags that can be overwritte - `__VUE_I18N_FULL_INSTALL__` (enable/disable, in addition to vue-i18n APIs, components and directives all fully support installation: `true`) - `__VUE_I18N_LEGACY_API__` (enable/disable vue-i18n legacy style APIs support, default: `true`) -- `__VUE_I18N_PROD_DEVTOOLS__` (enable/disable vue-devtools support in production, default: `false`) - `__INTLIFY_PROD_DEVTOOLS__` (enable/disable `@intlify/devtools` support in production, default: `false`) > NOTE: `__INTLIFY_PROD_DEVTOOLS__` flag is experimental, and `@intlify/devtools` is WIP yet. @@ -65,10 +64,6 @@ The build will work without configuring these flags, however it is **strongly re Note: the replacement value **must be boolean literals** and cannot be strings, otherwise the bundler/minifier will not be able to properly evaluate the conditions. -## Other Feature Flags - -- `__FEATURE_ESM_BUNDLER_WARN__` (Suppress / Not suppress feature flags recommended warnings in build for `esm-bulder`) - ## :copyright: License [MIT](http://opensource.org/licenses/MIT) diff --git a/packages/vue-i18n/src/misc.ts b/packages/vue-i18n/src/misc.ts index 65f9e6778..784db9fef 100644 --- a/packages/vue-i18n/src/misc.ts +++ b/packages/vue-i18n/src/misc.ts @@ -27,19 +27,10 @@ export function initFeatureFlags(): void { getGlobalThis().__VUE_I18N_LEGACY_API__ = true } - if (typeof __FEATURE_PROD_VUE_DEVTOOLS__ !== 'boolean') { - needWarn = true - getGlobalThis().__VUE_I18N_PROD_DEVTOOLS__ = false - } - if (typeof __FEATURE_PROD_INTLIFY_DEVTOOLS__ !== 'boolean') { getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false } - if (__DEV__ && typeof __FEATURE_ESM_BUNDLER_WARN__ === 'boolean') { - needWarn = __FEATURE_ESM_BUNDLER_WARN__ - } - if (__DEV__ && needWarn) { console.warn( `You are running the esm-bundler build of vue-i18n. It is recommended to ` + diff --git a/rollup.config.js b/rollup.config.js index a395881ca..4757ae73e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -230,12 +230,11 @@ function createReplacePlugin( ? `__VUE_I18N_LEGACY_API__` : true, __FEATURE_PROD_VUE_DEVTOOLS__: isBundlerESMBuild - ? `__VUE_I18N_PROD_DEVTOOLS__` + ? `__VUE_PROD_DEVTOOLS__` : false, __FEATURE_PROD_INTLIFY_DEVTOOLS__: isBundlerESMBuild ? `__INTLIFY_PROD_DEVTOOLS__` : false, - __FEATURE_ESM_BUNDLER_WARN__: true, preventAssignment: false, ...(isProduction && isBrowserBuild ? {