chore: fix typo

This commit is contained in:
Anthony Fu 2021-08-24 15:49:03 +08:00
parent fdd30a9378
commit 45f898e108
3 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
import { addVitePlugin, addWebpackPlugin, defineNuxtModule, addTemplate, resolveAlias, addPluginTemplate } from '@nuxt/kit'
import { resolve } from 'upath'
import type { Identifiers, GlobalImportsOptions } from './types'
import { TrsnsformPlugin } from './transform'
import { TransformPlugin } from './transform'
import { defaultIdentifiers } from './identifiers'
export default defineNuxtModule<GlobalImportsOptions>({
@ -22,8 +22,8 @@ export default defineNuxtModule<GlobalImportsOptions>({
})
} else {
// Transform to inject imports in production mode
addVitePlugin(TrsnsformPlugin.vite(identifiers))
addWebpackPlugin(TrsnsformPlugin.webpack(identifiers))
addVitePlugin(TransformPlugin.vite(identifiers))
addWebpackPlugin(TransformPlugin.webpack(identifiers))
}
// Add types

View File

@ -11,7 +11,7 @@ const excludeRegex = [
/\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')
return {

View File

@ -1,8 +1,8 @@
import { expect } from 'chai'
import { TrsnsformPlugin } from '../src/global-imports/transform'
import { TransformPlugin } from '../src/global-imports/transform'
describe('module:global-imports:build', () => {
const { transform } = TrsnsformPlugin.raw({ ref: 'vue' })
const { transform } = TransformPlugin.raw({ ref: 'vue' })
it('should correct inject', () => {
expect(transform('const a = ref(0)', ''))