Skip to content

Commit d85944a

Browse files
committed
fix(vite): allow full package resolution overrides
1 parent dfa3959 commit d85944a

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

packages/nuxt/src/module.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ export default defineNuxtModule<ModuleOptions>({
110110
config.plugins.push(SchemaOrgVitePlugin({
111111
mock: !moduleOptions.client && isClient,
112112
full: moduleOptions.full,
113-
runtimePath: nuxtSchemaComposablesRuntime,
113+
aliasPaths: {
114+
pkgDir: schemaOrgPath,
115+
runtime: nuxtSchemaComposablesRuntime,
116+
},
114117
}))
115118
})
116119
},

packages/vite/src/plugins.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ export interface PluginOptions {
1515
/**
1616
* Path to a real custom runtime (not mocked).
1717
*/
18-
runtimePath?: string
19-
/**
20-
* Path to a real custom provider (not mocked).
21-
*/
22-
providerPath?: string
18+
aliasPaths?: {
19+
pkgDir?: string
20+
provider?: string
21+
runtime?: string
22+
}
2323
/**
2424
* Scan files from this root directory (ignoring node_modules).
2525
*/
@@ -40,14 +40,14 @@ export const schemaOrgSwapAliases = () => createUnplugin<PluginOptions>((args) =
4040
const fetchPaths = async () => {
4141
if (paths)
4242
return paths
43-
const pkgDir = dirname(await resolvePath(SchemaOrgPkg))
43+
const pkgDir = args.aliasPaths?.pkgDir || dirname(await resolvePath(SchemaOrgPkg))
4444
let provider, runtime
4545
if (args?.mock) {
4646
provider = runtime = await resolvePath(`${SchemaOrgPkg}/runtime/mock`)
4747
}
4848
else {
49-
provider = args?.providerPath || await resolvePath(`${SchemaOrgPkg}/${args?.full ? 'full' : 'simple'}`)
50-
runtime = args?.runtimePath || await resolvePath(`${SchemaOrgPkg}/runtime`)
49+
provider = args.aliasPaths?.provider || await resolvePath(`${SchemaOrgPkg}/${args?.full ? 'full' : 'simple'}`)
50+
runtime = args.aliasPaths?.runtime || await resolvePath(`${SchemaOrgPkg}/runtime`)
5151
}
5252
paths = {
5353
pkgDir,

0 commit comments

Comments
 (0)