diff --git a/src/babel/plugin-debug-label.ts b/src/babel/plugin-debug-label.ts index 8dfd03c51b..a8fb77fd50 100644 --- a/src/babel/plugin-debug-label.ts +++ b/src/babel/plugin-debug-label.ts @@ -1,4 +1,4 @@ -import path from 'path' +import { basename, dirname, extname } from 'path' import babel, { PluginObj } from '@babel/core' import _templateBuilder from '@babel/template' import { isAtom } from './utils.ts' @@ -20,11 +20,11 @@ export default function debugLabelPlugin( ) { const filename = state.filename || 'unknown' - let displayName = path.basename(filename, path.extname(filename)) + let displayName = basename(filename, extname(filename)) // ./{module name}/index.js if (displayName === 'index') { - displayName = path.basename(path.dirname(filename)) + displayName = basename(dirname(filename)) } // Relies on visiting the variable declaration to add the debugLabel const buildExport = templateBuilder(`