This repository was archived by the owner on Dec 5, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +12
-23
lines changed Expand file tree Collapse file tree 7 files changed +12
-23
lines changed Original file line number Diff line number Diff line change 20
20
"sideEffects" : true ,
21
21
"exports" : {
22
22
"." : {
23
- "import" : " ./dist/index.mjs" ,
24
- "require" : " ./dist/index.js"
23
+ "import" : " ./dist/runtime/ index.mjs" ,
24
+ "require" : " ./dist/runtime/ index.js"
25
25
},
26
26
"./module" : " ./dist/module.js" ,
27
27
"./package.json" : " ./package.json" ,
28
28
"./dist/babel-plugin" : " ./dist/babel-plugin.js" ,
29
- "./dist/runtime/globals" : " ./dist/runtime/globals.js" ,
30
- "./dist/runtime/register" : " ./dist/runtime/register.js" ,
31
- "./dist/runtime/templates/*" : " ./dist/runtime/templates/*"
29
+ "./dist/runtime/*" : " ./dist/runtime/*"
32
30
},
33
- "main" : " ./dist/index.js" ,
34
- "module" : " ./dist/index.mjs" ,
31
+ "main" : " ./dist/runtime/ index.js" ,
32
+ "module" : " ./dist/runtime/ index.mjs" ,
35
33
"types" : " ./dist/index.d.ts" ,
36
34
"files" : [
37
35
" dist" ,
Original file line number Diff line number Diff line change 1
- export * from './runtime/composables'
1
+ /* dummy entry for types field */
2
+ export * from './runtime'
Original file line number Diff line number Diff line change @@ -14,18 +14,11 @@ const compositionApiModule: Module<never> = function compositionApiModule() {
14
14
15
15
addGlobalsFile . call ( this )
16
16
17
- // Add library alias for benefit of vite
18
-
19
- nuxtOptions . alias [ '~composition-api' ] = resolve ( __dirname , 'index.mjs' )
20
-
21
17
// Force transpilation of this library (to enable resolution of globals file)
22
18
19
+ const runtimeDir = resolve ( __dirname , 'runtime' )
23
20
nuxtOptions . build . transpile = nuxtOptions . build . transpile || [ ]
24
- nuxtOptions . build . transpile . push (
25
- '@nuxtjs/composition-api' ,
26
- '~composition-api' ,
27
- __dirname
28
- )
21
+ nuxtOptions . build . transpile . push ( '@nuxtjs/composition-api' , runtimeDir )
29
22
30
23
// Define @vue /composition-api resolution to prevent using different versions of @vue/composition-api
31
24
Original file line number Diff line number Diff line change 1
- import '@nuxtjs/composition-api/dist/runtime /register'
1
+ import '.. /register'
2
2
3
3
export { useAsync } from './async'
4
4
export { defineComponent } from './component'
Original file line number Diff line number Diff line change
1
+ export * from './composables'
Original file line number Diff line number Diff line change @@ -17,10 +17,6 @@ export function compositionApiPlugin(): Plugin & { enforce: 'pre' } {
17
17
name : 'nuxt:composition-api' ,
18
18
enforce : 'pre' ,
19
19
transform ( code : string , filename : string ) {
20
- code = code . replace (
21
- / @ n u x t j s [ \\ / ] c o m p o s i t i o n - a p i (? ! [ \\ / ] ) / g,
22
- '~composition-api'
23
- )
24
20
const keyedFunctions =
25
21
/ ( u s e S t a t i c | s h a l l o w S s r R e f | s s r P r o m i s e | s s r R e f | r e q S s r R e f | u s e A s y n c ) /
26
22
if ( ! keyedFunctions . test ( code ) ) {
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ export default <NuxtConfig>{
27
27
) ,
28
28
'@nuxtjs/composition-api' : join (
29
29
rootDir ,
30
- inDevelopment ? 'src/index.ts' : 'dist/index.js'
30
+ inDevelopment ? 'src/runtime/ index.ts' : 'dist/runtime /index.js'
31
31
) ,
32
32
} ,
33
33
target : isGenerated ? 'static' : 'server' ,
You can’t perform that action at this time.
0 commit comments