-
-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathnuxt.mjs
More file actions
19 lines (16 loc) · 593 Bytes
/
nuxt.mjs
File metadata and controls
19 lines (16 loc) · 593 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { addImportsSources, addVitePlugin, addWebpackPlugin, defineNuxtModule } from '@nuxt/kit'
import * as magicRegexp from 'magic-regexp'
import { MagicRegExpTransformPlugin } from 'magic-regexp/transform'
export default defineNuxtModule({
setup(_options, nuxt) {
addImportsSources({
from: 'magic-regexp',
imports: Object.keys(magicRegexp),
})
// Disable RegExp code transformation in development mode
if (nuxt.options.dev)
return
addWebpackPlugin(MagicRegExpTransformPlugin.webpack())
addVitePlugin(MagicRegExpTransformPlugin.vite())
},
})