featureFlags.ts 935 B

12345678910111213141516171819202122232425262728293031
  1. import { getGlobalThis } from '@vue/shared'
  2. /**
  3. * This is only called in esm-bundler builds.
  4. * It is called when a renderer is created, in `baseCreateRenderer` so that
  5. * importing runtime-core is side-effects free.
  6. *
  7. * istanbul-ignore-next
  8. */
  9. export function initFeatureFlags() {
  10. let needWarn = false
  11. if (typeof __FEATURE_OPTIONS_API__ !== 'boolean') {
  12. needWarn = true
  13. getGlobalThis().__VUE_OPTIONS_API__ = true
  14. }
  15. if (typeof __FEATURE_PROD_DEVTOOLS__ !== 'boolean') {
  16. needWarn = true
  17. getGlobalThis().__VUE_PROD_DEVTOOLS__ = false
  18. }
  19. if (__DEV__ && needWarn) {
  20. console.warn(
  21. `You are running the esm-bundler build of Vue. It is recommended to ` +
  22. `configure your bundler to explicitly replace feature flag globals ` +
  23. `with boolean literals to get proper tree-shaking in the final bundle. ` +
  24. `See http://link.vuejs.org/feature-flags for more details.`
  25. )
  26. }
  27. }