Skip to content

Commit 19223f5

Browse files
committed
build: remove __BUNLDER__ flag so that HMR is available for all builds
1 parent fa40d1e commit 19223f5

File tree

8 files changed

+6
-14
lines changed

8 files changed

+6
-14
lines changed

jest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ module.exports = {
55
__TEST__: true,
66
__VERSION__: require('./package.json').version,
77
__BROWSER__: false,
8-
__BUNDLER__: true,
98
__RUNTIME_COMPILE__: true,
109
__GLOBAL__: false,
1110
__NODE_JS__: true,

packages/global.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
declare var __DEV__: boolean
33
declare var __TEST__: boolean
44
declare var __BROWSER__: boolean
5-
declare var __BUNDLER__: boolean
65
declare var __RUNTIME_COMPILE__: boolean
76
declare var __GLOBAL__: boolean
87
declare var __NODE_JS__: boolean

packages/runtime-core/src/apiCreateApp.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ export function createAppAPI<HostElement>(
209209
vnode.appContext = context
210210

211211
// HMR root reload
212-
if (__BUNDLER__ && __DEV__) {
212+
if (__DEV__) {
213213
context.reload = () => {
214214
render(cloneVNode(vnode), rootContainer)
215215
}

packages/runtime-core/src/componentRenderUtils.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,6 @@ export function shouldUpdateComponent(
213213
// caused the child component's slots content to have changed, we need to
214214
// force the child to update as well.
215215
if (
216-
__BUNDLER__ &&
217216
__DEV__ &&
218217
(prevChildren || nextChildren) &&
219218
parentComponent &&

packages/runtime-core/src/hmr.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface HMRRuntime {
1616
// it easier to be used in toolings like vue-loader
1717
// Note: for a component to be eligible for HMR it also needs the __hmrId option
1818
// to be set so that its instances can be registered / removed.
19-
if (__BUNDLER__ && __DEV__) {
19+
if (__DEV__) {
2020
const globalObject: any =
2121
typeof global !== 'undefined'
2222
? global

packages/runtime-core/src/renderer.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ import { createHydrationFunctions, RootHydrateFunction } from './hydration'
6464
import { invokeDirectiveHook } from './directives'
6565
import { startMeasure, endMeasure } from './profiling'
6666

67-
const __HMR__ = __BUNDLER__ && __DEV__
68-
6967
export interface Renderer<HostElement = any> {
7068
render: RootRenderFunction<HostElement>
7169
createApp: CreateAppFunction<HostElement>
@@ -660,7 +658,7 @@ function baseCreateRenderer(
660658
invokeDirectiveHook(n2, n1, parentComponent, 'beforeUpdate')
661659
}
662660

663-
if (__HMR__ && parentComponent && parentComponent.renderUpdated) {
661+
if (__DEV__ && parentComponent && parentComponent.renderUpdated) {
664662
// HMR updated, force full diff
665663
patchFlag = 0
666664
optimized = false
@@ -884,7 +882,7 @@ function baseCreateRenderer(
884882
optimized = true
885883
}
886884

887-
if (__HMR__ && parentComponent && parentComponent.renderUpdated) {
885+
if (__DEV__ && parentComponent && parentComponent.renderUpdated) {
888886
// HMR updated, force full diff
889887
patchFlag = 0
890888
optimized = false
@@ -987,7 +985,7 @@ function baseCreateRenderer(
987985
parentSuspense
988986
))
989987

990-
if (__HMR__ && instance.type.__hmrId) {
988+
if (__DEV__ && instance.type.__hmrId) {
991989
registerHMR(instance)
992990
}
993991

@@ -1807,7 +1805,7 @@ function baseCreateRenderer(
18071805
parentSuspense: SuspenseBoundary | null,
18081806
doRemove?: boolean
18091807
) => {
1810-
if (__HMR__ && instance.type.__hmrId) {
1808+
if (__DEV__ && instance.type.__hmrId) {
18111809
unregisterHMR(instance)
18121810
}
18131811

packages/runtime-core/src/vnode.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,6 @@ export function isVNode(value: any): value is VNode {
200200

201201
export function isSameVNodeType(n1: VNode, n2: VNode): boolean {
202202
if (
203-
__BUNDLER__ &&
204203
__DEV__ &&
205204
n2.shapeFlag & ShapeFlags.COMPONENT &&
206205
(n2.type as Component).__hmrUpdated

rollup.config.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,6 @@ function createReplacePlugin(
178178
__TEST__: false,
179179
// If the build is expected to run directly in the browser (global / esm builds)
180180
__BROWSER__: isBrowserBuild,
181-
// is targeting bundlers?
182-
__BUNDLER__: isBundlerESMBuild,
183181
__GLOBAL__: isGlobalBuild,
184182
// is targeting Node (SSR)?
185183
__NODE_JS__: isNodeBuild,

0 commit comments

Comments
 (0)