File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -3,8 +3,11 @@ import { resolve, join } from 'pathe'
33import { joinURL } from 'ufo'
44import { defineNuxtModule , extendViteConfig , updateTemplates } from '@nuxt/kit'
55import { addPlugin , addImports , addComponent , addTemplate } from '@nuxt/kit'
6+ import { useLogger , getNuxtVersion } from '@nuxt/kit'
67import { Database } from './builder'
78
9+ const logger = useLogger ( 'nuxt-db' )
10+
811export default defineNuxtModule ( {
912 meta : {
1013 name : 'nuxt-db' ,
@@ -32,6 +35,20 @@ export default defineNuxtModule({
3235 config . optimizeDeps . include . push ( 'fuzzysort' )
3336 } )
3437
38+ if ( nuxt . options . dev ) {
39+ try {
40+ const matches = getNuxtVersion ( nuxt ) . match ( / ^ ( \d + \. \d + ) / )
41+ const version = Number ( matches [ 0 ] . replace ( '.' , '' ) )
42+
43+ if ( version < 317 ) {
44+ logger . info ( 'Adding nitropack to build.transpile' )
45+ nuxt . options . build . transpile . push ( 'nitropack' )
46+ }
47+ } catch ( error ) {
48+ logger . info ( 'Checking nuxt version failed:' , error . message )
49+ }
50+ }
51+
3552 const isDev = nuxt . options . dev
3653 const srcDir = nuxt . options . srcDir
3754 const baseURL = nuxt . options . app . baseURL
You can’t perform that action at this time.
0 commit comments