fix(admin-vite-plugin): Normalize file paths and add tests (#9595)
**What** - #9338 had a regression which caused the import path in some virtual modules to be invalid on Windows. - This PR fixes the issue so we now again create the correct import paths, and adds tests to prevent this from slipping in again.
This commit is contained in:
committed by
GitHub
parent
84fa6ccde5
commit
813efeae51
@@ -16,6 +16,7 @@ import {
|
||||
getConfigObjectProperties,
|
||||
getParserOptions,
|
||||
hasDefaultExport,
|
||||
normalizePath,
|
||||
} from "../utils"
|
||||
import { getWidgetFilesFromSources } from "./helpers"
|
||||
|
||||
@@ -135,9 +136,10 @@ function generateWidgetConfigName(index: number): string {
|
||||
}
|
||||
|
||||
function generateImport(file: string, index: number): string {
|
||||
const path = normalizePath(file)
|
||||
return `import ${generateWidgetComponentName(
|
||||
index
|
||||
)}, { config as ${generateWidgetConfigName(index)} } from "${file}"`
|
||||
)}, { config as ${generateWidgetConfigName(index)} } from "${path}"`
|
||||
}
|
||||
|
||||
function generateWidget(zone: InjectionZone[], index: number): WidgetConfig {
|
||||
|
||||
Reference in New Issue
Block a user