mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
chore: fix typo
This commit is contained in:
parent
fdd30a9378
commit
45f898e108
@ -1,7 +1,7 @@
|
|||||||
import { addVitePlugin, addWebpackPlugin, defineNuxtModule, addTemplate, resolveAlias, addPluginTemplate } from '@nuxt/kit'
|
import { addVitePlugin, addWebpackPlugin, defineNuxtModule, addTemplate, resolveAlias, addPluginTemplate } from '@nuxt/kit'
|
||||||
import { resolve } from 'upath'
|
import { resolve } from 'upath'
|
||||||
import type { Identifiers, GlobalImportsOptions } from './types'
|
import type { Identifiers, GlobalImportsOptions } from './types'
|
||||||
import { TrsnsformPlugin } from './transform'
|
import { TransformPlugin } from './transform'
|
||||||
import { defaultIdentifiers } from './identifiers'
|
import { defaultIdentifiers } from './identifiers'
|
||||||
|
|
||||||
export default defineNuxtModule<GlobalImportsOptions>({
|
export default defineNuxtModule<GlobalImportsOptions>({
|
||||||
@ -22,8 +22,8 @@ export default defineNuxtModule<GlobalImportsOptions>({
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
// Transform to inject imports in production mode
|
// Transform to inject imports in production mode
|
||||||
addVitePlugin(TrsnsformPlugin.vite(identifiers))
|
addVitePlugin(TransformPlugin.vite(identifiers))
|
||||||
addWebpackPlugin(TrsnsformPlugin.webpack(identifiers))
|
addWebpackPlugin(TransformPlugin.webpack(identifiers))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add types
|
// Add types
|
||||||
|
@ -11,7 +11,7 @@ const excludeRegex = [
|
|||||||
/\b(?:const|let|var)\s*([\w\d_$]+?)\b/g
|
/\b(?:const|let|var)\s*([\w\d_$]+?)\b/g
|
||||||
]
|
]
|
||||||
|
|
||||||
export const TrsnsformPlugin = createUnplugin((map: IdentifierMap) => {
|
export const TransformPlugin = createUnplugin((map: IdentifierMap) => {
|
||||||
const regex = new RegExp('\\b(' + (Object.keys(map).join('|')) + ')\\b', 'g')
|
const regex = new RegExp('\\b(' + (Object.keys(map).join('|')) + ')\\b', 'g')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { expect } from 'chai'
|
import { expect } from 'chai'
|
||||||
import { TrsnsformPlugin } from '../src/global-imports/transform'
|
import { TransformPlugin } from '../src/global-imports/transform'
|
||||||
|
|
||||||
describe('module:global-imports:build', () => {
|
describe('module:global-imports:build', () => {
|
||||||
const { transform } = TrsnsformPlugin.raw({ ref: 'vue' })
|
const { transform } = TransformPlugin.raw({ ref: 'vue' })
|
||||||
|
|
||||||
it('should correct inject', () => {
|
it('should correct inject', () => {
|
||||||
expect(transform('const a = ref(0)', ''))
|
expect(transform('const a = ref(0)', ''))
|
||||||
|
Loading…
Reference in New Issue
Block a user