Skip to content

Commit

Permalink
fix: resolve options
Browse files Browse the repository at this point in the history
  • Loading branch information
sxzz committed Aug 26, 2024
1 parent 036d80e commit 0aadd0b
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,19 +155,31 @@ export type ResolvedOptions = Omit<Options, 'customElement'> &
| 'root'
| 'compiler'
| 'inlineTemplate'
| 'features'
>
> & {
/** Vite only */
devServer?: ViteDevServer
devToolsEnabled?: boolean
cssDevSourcemap: boolean
features: NonNullable<Options['features']>
}

function resolveOptions(rawOptions: Options): ResolvedOptions {
const root = rawOptions.root ?? process.cwd()
const isProduction =
rawOptions.isProduction ?? process.env.NODE_ENV === 'production'
const features = {
...rawOptions.features,
optionsAPI: true,
prodDevtools: false,
prodHydrationMismatchDetails: false,
propsDestructure: false,
...rawOptions.features,
customElement:
(rawOptions.features?.customElement || rawOptions.customElement) ??
/\.ce\.vue$/,
}

return {
...rawOptions,
include: rawOptions.include ?? /\.vue$/,
Expand All @@ -176,19 +188,10 @@ function resolveOptions(rawOptions: Options): ResolvedOptions {
sourceMap: rawOptions.sourceMap ?? true,
root,
compiler: rawOptions.compiler as any, // to be set in buildStart
devToolsEnabled: !isProduction,
devToolsEnabled: features.prodDevtools || !isProduction,
cssDevSourcemap: false,
inlineTemplate: rawOptions.inlineTemplate ?? true,
features: {
optionsAPI: true,
prodDevtools: false,
prodHydrationMismatchDetails: false,
propsDestructure: false,
...rawOptions.features,
customElement:
(rawOptions.features?.customElement || rawOptions.customElement) ??
/\.ce\.vue$/,
},
features,
}
}

Expand Down

0 comments on commit 0aadd0b

Please sign in to comment.