fix: import fs-extra error in module project (#499)

This commit is contained in:
Hexqi 2024-05-21 19:29:30 +08:00 committed by GitHub
parent fa39c12904
commit 69cafd5979
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import path from 'node:path'
import { readJsonSync } from 'fs-extra'
import fs from 'fs-extra'
import { installPackageTemporary } from '../vite-plugins/installPackageTemporary'
import { configServerAddProxy } from '../vite-plugins/configureServerAddProxy'
import { viteStaticCopy } from 'vite-plugin-static-copy'
@ -10,6 +10,8 @@ import {
copyfileToDynamicSrcMapper
} from './locateCdnNpmInfo'
const { readJsonSync } = fs
export function extraBundleCdnLink(filename, originCdnPrefix) {
const result = []
const bundle = readJsonSync(filename)

View File

@ -1,5 +1,5 @@
import path from 'node:path'
import { readJsonSync } from 'fs-extra'
import fs from 'fs-extra'
import {
getPackageNeedToInstallAndFilesUsingSameVersion,
copyfileToDynamicSrcMapper,
@ -10,6 +10,8 @@ import {
import { viteStaticCopy } from 'vite-plugin-static-copy'
import { installPackageTemporary } from '../vite-plugins/installPackageTemporary'
const { readJsonSync } = fs
export function extraPreviewImport(filename, originCdnPrefix) {
const result = []
const importMap = readJsonSync(filename)

View File

@ -1,10 +1,11 @@
import path from 'node:path'
import fs from 'node:fs'
import fs from 'fs-extra'
import fg from 'fast-glob'
import { normalizePath } from 'vite'
import { readJsonSync } from 'fs-extra'
import { babelReplaceImportPathWithCertainFileName } from './replaceImportPath.mjs'
const { readJsonSync } = fs
function transform(content, filename) {
if (filename.endsWith('.js')) {
const result = babelReplaceImportPathWithCertainFileName(content, filename, console)