1
- import { fileURLToPath } from " url" ;
1
+ import { fileURLToPath } from ' url'
2
2
import {
3
3
defineNuxtModule ,
4
4
addPlugin ,
5
5
createResolver ,
6
- addServerPlugin ,
7
- } from " @nuxt/kit" ;
6
+ addServerPlugin
7
+ } from ' @nuxt/kit'
8
8
9
9
declare global {
10
10
interface Window {
@@ -15,31 +15,31 @@ declare global {
15
15
16
16
export default defineNuxtModule ( {
17
17
meta : {
18
- name : " @nuxtjs/emotion" ,
19
- configKey : " emotion" ,
20
- compatibilty : " >=3.0.0" ,
18
+ name : ' @nuxtjs/emotion' ,
19
+ configKey : ' emotion' ,
20
+ compatibilty : ' >=3.0.0'
21
21
} ,
22
- setup ( options , nuxt ) {
22
+ setup ( options , nuxt ) {
23
23
// ensure `nitro.plugins` is initialized
24
- nuxt . options . nitro . plugins = nuxt . options . nitro . plugins || [ ] ;
24
+ nuxt . options . nitro . plugins = nuxt . options . nitro . plugins || [ ]
25
25
26
- nuxt . hook ( " nitro:config" , ( config ) => {
26
+ nuxt . hook ( ' nitro:config' , ( config ) => {
27
27
// Prevent inlining emotion (+ the crucial css cache!) in dev mode
28
28
if ( nuxt . options . dev ) {
29
29
if ( config . externals ) {
30
- config . externals . external ||= [ ] ;
31
- config . externals . external . push ( " @emotion/server" ) ;
30
+ config . externals . external ||= [ ]
31
+ config . externals . external . push ( ' @emotion/server' )
32
32
}
33
33
}
34
- } ) ;
34
+ } )
35
35
36
36
/**
37
37
* Register emotion plugin
38
38
*/
39
- const { resolve } = createResolver ( import . meta. url ) ;
40
- const runtimeDir = fileURLToPath ( new URL ( " ./runtime" , import . meta. url ) ) ;
41
- nuxt . options . build . transpile . push ( runtimeDir ) ;
42
- addServerPlugin ( resolve ( runtimeDir , " emotion.server" ) ) ;
43
- addPlugin ( resolve ( runtimeDir , " emotion.client" ) ) ;
44
- } ,
45
- } ) ;
39
+ const { resolve } = createResolver ( import . meta. url )
40
+ const runtimeDir = fileURLToPath ( new URL ( ' ./runtime' , import . meta. url ) )
41
+ nuxt . options . build . transpile . push ( runtimeDir )
42
+ addServerPlugin ( resolve ( runtimeDir , ' emotion.server' ) )
43
+ addPlugin ( resolve ( runtimeDir , ' emotion.client' ) )
44
+ }
45
+ } )
0 commit comments