Skip to content

Commit b722a62

Browse files
authored
feat(markdown): add error log for importCode plugin (#1273)
1 parent e9b35cf commit b722a62

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/markdown/src/plugins/importCodePlugin/resolveImportCode.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fs, path } from '@vuepress/utils'
1+
import { colors, fs, logger, path } from '@vuepress/utils'
22
import type { MarkdownEnv } from '../../types.js'
33
import type { ImportCodeTokenMeta } from './types.js'
44

@@ -15,6 +15,9 @@ export const resolveImportCode = (
1515
// if the importPath is relative path, we need to resolve it
1616
// according to the markdown filePath
1717
if (!filePath) {
18+
logger.error(
19+
`Import file ${colors.magenta(importPath)} can not be resolved`
20+
)
1821
return {
1922
importFilePath: null,
2023
importCode: 'Error when resolving path',
@@ -25,6 +28,7 @@ export const resolveImportCode = (
2528

2629
// check file existence
2730
if (!fs.existsSync(importFilePath)) {
31+
logger.error(`Import file ${colors.magenta(importPath)} not found`)
2832
return {
2933
importFilePath,
3034
importCode: 'File not found',

0 commit comments

Comments
 (0)