Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/dynamic-import-to-glob.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import path from 'node:path'

const example = 'For example: import(`./foo/${bar}.js`).'

function sanitizeString(str: string) {
if (str.includes('*')) {
throw new Error('A dynamic import cannot contain * characters.')
function sanitizeString(str: any) {
if(typeof str === "string" ){
if (str.includes('*')) {
throw new Error('A dynamic import cannot contain * characters.')
}
return str
} else {
return "*"
}
return str
}

function templateLiteralToGlob(node: AcornNode) {
Expand Down