Skip to content

Commit 58c033c

Browse files
committed
fix: remove devtools from iife build
Fix #2608 The devtools package doesn't have an IIFE build so it simply cannot have it. In order to not break the IIFE build, the devtools are simply removed. The same happened with pinia: - vuejs/pinia#2914 - vuejs/devtools#989
1 parent 0a6c674 commit 58c033c

File tree

5 files changed

+168
-91
lines changed

5 files changed

+168
-91
lines changed

packages/router/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@
148148
"picomatch": "^4.0.3",
149149
"scule": "^1.3.0",
150150
"tinyglobby": "^0.2.15",
151-
"unplugin": "^2.3.11",
151+
"unplugin": "^3.0.0",
152152
"unplugin-utils": "^0.3.1",
153153
"yaml": "^2.8.2"
154154
},
@@ -182,7 +182,7 @@
182182
"rimraf": "^6.1.2",
183183
"rollup": "^4.55.1",
184184
"rollup-plugin-typescript2": "^0.36.0",
185-
"tsdown": "0.20.0-beta.3",
185+
"tsdown": "^0.20.1",
186186
"tsup": "^8.5.1",
187187
"vite": "^7.3.0",
188188
"vue": "3.6.0-beta.2"

packages/router/src/global.d.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
// Global compile-time constants
22
declare var __DEV__: boolean
33
declare var __TEST__: boolean
4+
// TODO: refactor all these feature flags
45
declare var __FEATURE_PROD_DEVTOOLS__: boolean
6+
// iifee build cannot have v8 devtools because they are too heavy
7+
declare var __STRIP_DEVTOOLS__: boolean
58
declare var __BROWSER__: boolean

packages/router/src/router.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1067,7 +1067,11 @@ export function createRouter(options: RouterOptions): Router {
10671067
}
10681068

10691069
// TODO: this probably needs to be updated so it can be used by vue-termui
1070-
if ((__DEV__ || __FEATURE_PROD_DEVTOOLS__) && isBrowser) {
1070+
if (
1071+
(__DEV__ || __FEATURE_PROD_DEVTOOLS__) &&
1072+
isBrowser &&
1073+
!__STRIP_DEVTOOLS__
1074+
) {
10711075
addDevtools(app, router as Router, matcher)
10721076
}
10731077
},

packages/router/tsdown.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ const commonOptions = {
3737
__BROWSER__: 'true',
3838
// is replaced by the vite vue plugin
3939
__FEATURE_PROD_DEVTOOLS__: `__VUE_PROD_DEVTOOLS__`,
40+
// by default we keep them
41+
__STRIP_DEVTOOLS__: `false`,
4042
},
4143
dts: false,
4244
// TODO: remove in v5
@@ -125,8 +127,6 @@ const cjsProd = {
125127
const iife = {
126128
...commonOptions,
127129
format: 'iife',
128-
// TODO: remove when upgrading to devtools-api v7 because it's too big
129-
noExternal: ['@vue/devtools-api'],
130130
outputOptions: {
131131
...commonOptions.outputOptions,
132132
dir: undefined, // must be unset with file
@@ -135,7 +135,9 @@ const iife = {
135135
define: {
136136
...commonOptions.define,
137137
__DEV__: 'true',
138-
__FEATURE_PROD_DEVTOOLS__: `true`,
138+
// the new devtools api does not have iife support and are too heavy
139+
__FEATURE_PROD_DEVTOOLS__: `false`,
140+
__STRIP_DEVTOOLS__: `true`,
139141
},
140142
} satisfies InlineConfig
141143

0 commit comments

Comments
 (0)