8000 fix: resolve options · unplugin/unplugin-vue@0aadd0b · GitHub
[go: up one dir, main page]

Skip to content

Commit 0aadd0b

Browse files
committed
fix: resolve options
1 parent 036d80e commit 0aadd0b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/core/index.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -155,19 +155,31 @@ export type ResolvedOptions = Omit<Options, 'customElement'> &
155155
| 'root'
156156
| 'compiler'
157157
| 'inlineTemplate'
158+
| 'features'
158159
>
159160
> & {
160161
/** Vite only */
161162
devServer?: ViteDevServer
162163
devToolsEnabled?: boolean
163164
cssDevSourcemap: boolean
164-
features: NonNullable<Options['features']>
165165
}
166166

167167
function resolveOptions(rawOptions: Options): ResolvedOptions {
168168
const root = rawOptions.root ?? process.cwd()
169169
const isProduction =
170170
rawOptions.isProduction ?? process.env.NODE_ENV === 'production'
171+
const features = {
172+
...rawOptions.features,
173+
optionsAPI: true,
174+
prodDevtools: false,
175+
prodHydrationMismatchDetails: false,
176+
propsDestructure: false,
177+
...rawOptions.features,
178+
customElement:
179+
(rawOptions.features?.customElement || rawOptions.customElement) ??
180+
/\.ce\.vue$/,
181+
}
182+
171183
return {
172184
...rawOptions,
173185
include: rawOptions.include ?? /\.vue$/,
@@ -176,19 +188,10 @@ function resolveOptions(rawOptions: Options): ResolvedOptions {
176188
sourceMap: rawOptions.sourceMap ?? true,
177189
root,
178190
compiler: rawOptions.compiler as any, // to be set in buildStart
179-
devToolsEnabled: !isProduction,
191+
devToolsEnabled: features.prodDevtools || !isProduction,
180192
cssDevSourcemap: false,
181193
inlineTemplate: rawOptions.inlineTemplate ?? true,
182-
features: {
183-
optionsAPI: true,
184-
prodDevtools: false,
185-
prodHydrationMismatchDetails: false,
186-
propsDestructure: false,
187-
...rawOptions.features,
188-
customElement:
189-
(rawOptions.features?.customElement || rawOptions.customElement) ??
190-
/\.ce\.vue$/,
191-
},
194+
features,
192195
}
193196
}
194197

0 commit comments

Comments
 (0)
0