File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -160,8 +160,17 @@ export const unpluginFactory: UnpluginFactory<Options | undefined> = (
160160 async transform ( code , id ) {
161161 // Replace all instances of `/* @__formkit_config__ */` in the code
162162 // with the resolved path to the formkit.config.{ts,js,mjs} file.
163- if ( configPath ) {
163+ if ( configPath && FORMKIT_CONFIG_RE . test ( code ) ) {
164164 code = code . replace ( FORMKIT_CONFIG_RE , `"${ configPath } ")` )
165+ if ( options . defaultConfig === false ) {
166+ // If the user has explicitly disabled the default config, we need
167+ // to remove the defaultConfig from the FormKitConfigLoader. We can
168+ // do this by cutting the /* @__default -config__ */ comment area.
169+ code = code . replace (
170+ / \/ \* @ _ _ d e f a u l t - c o n f i g _ _ \* \/ (?: .| \n ) + ?\/ \* @ _ _ d e f a u l t - c o n f i g _ _ \* \/ / gi,
171+ '' ,
172+ )
173+ }
165174 }
166175 // Test if the given code is a likely candidate for FormKit usage.
167176 if ( id . endsWith ( '.vue' ) && CONTAINS_FORMKIT_RE . test ( code ) ) {
You can’t perform that action at this time.
0 commit comments