File tree Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Expand file tree Collapse file tree 3 files changed +10
-0
lines changed Original file line number Diff line number Diff line change 1
1
import { defineNuxtModule , addPlugin , createResolver } from '@nuxt/kit'
2
2
3
+ // https://github.com/nuxt/module-builder/issues/242
4
+ import type { SharedTypeFromRuntime } from './runtime/plugins/plugin'
5
+
3
6
// Module options TypeScript interface definition
4
7
export interface ModuleOptions {
5
8
apiKey : string
9
+ shared ?: SharedTypeFromRuntime
6
10
}
7
11
8
12
export interface ModuleHooks {
@@ -33,6 +37,9 @@ export default defineNuxtModule<ModuleOptions>({
33
37
setup ( _options , _nuxt ) {
34
38
const resolver = createResolver ( import . meta. url )
35
39
40
+ // @ts -expect-error type should be resolved
41
+ _options . shared = 'not-shared-type'
42
+
36
43
// Do not add the extension since the `.ts` will be transpiled to `.mjs` after `npm run prepack`
37
44
addPlugin ( resolver . resolve ( './runtime/plugins/plugin' ) )
38
45
} ,
Original file line number Diff line number Diff line change 1
1
import { defineNuxtPlugin } from '#app'
2
2
3
+ export type SharedTypeFromRuntime = 'shared-type'
4
+
3
5
export default defineNuxtPlugin ( ( ) => {
4
6
console . log ( 'Plugin injected by my-module!' )
5
7
return {
Original file line number Diff line number Diff line change @@ -58,6 +58,7 @@ export default defineCommand({
58
58
cjsBridge : true ,
59
59
} ,
60
60
externals : [
61
+ / s r c \/ r u n t i m e / ,
61
62
'@nuxt/schema' ,
62
63
'@nuxt/schema-nightly' ,
63
64
'@nuxt/schema-edge' ,
You can’t perform that action at this time.
0 commit comments