perf: mock semver import (#1006)

zio/stable
Daniel Roe 2023-01-12 16:31:18 +00:00 committed by GitHub
parent dcec32338c
commit 32aa47e701
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

7
mocks/semver.ts 100644
View File

@ -0,0 +1,7 @@
import proxy from 'unenv/runtime/mock/proxy'
export const lt = proxy
export const gt = proxy
export const gte = proxy
export const satisfies = proxy
export class SemVer {}

View File

@ -1,3 +1,4 @@
import { createResolver } from '@nuxt/kit'
import Inspect from 'vite-plugin-inspect' import Inspect from 'vite-plugin-inspect'
import { isCI, isDevelopment } from 'std-env' import { isCI, isDevelopment } from 'std-env'
import { isPreview } from './config/env' import { isPreview } from './config/env'
@ -5,6 +6,8 @@ import { i18n } from './config/i18n'
import { pwa } from './config/pwa' import { pwa } from './config/pwa'
import type { BuildInfo } from './types' import type { BuildInfo } from './types'
const { resolve } = createResolver(import.meta.url)
export default defineNuxtConfig({ export default defineNuxtConfig({
typescript: { typescript: {
tsConfig: { tsConfig: {
@ -44,6 +47,7 @@ export default defineNuxtConfig({
alias: { alias: {
'querystring': 'rollup-plugin-node-polyfills/polyfills/qs', 'querystring': 'rollup-plugin-node-polyfills/polyfills/qs',
'change-case': 'scule', 'change-case': 'scule',
'semver': resolve('./mocks/semver'),
}, },
imports: { imports: {
dirs: [ dirs: [