Skip to content

Commit

Permalink
fix: import SPFx project fail due to case sensitive file system on ub…
Browse files Browse the repository at this point in the history
…untu
  • Loading branch information
HuihuiWu-Microsoft committed Jul 8, 2024
1 parent 6298a60 commit 0396ba1
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions packages/fx-core/src/component/generator/spfx/spfxGenerator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -649,23 +649,24 @@ export class SPFxGenerator {
return undefined;
}

const webpartName = webparts[0].split(path.sep).pop();
const webpartManifestPath = path.join(
webpartsDir,
webparts[0],
`${webpartName as string}WebPart.manifest.json`
const webpartManifest = (await fs.readdir(path.join(webpartsDir, webparts[0]))).find((file) =>
file.endsWith("WebPart.manifest.json")
);
if (!(await fs.pathExists(webpartManifestPath))) {
if (webpartManifest === undefined) {
throw new FileNotFoundError(
Constants.PLUGIN_NAME,
webpartManifestPath,
path.join(
webpartsDir,
webparts[0],
`${webparts[0].split(path.sep).pop() as string}WebPart.manifest.json`
),
Constants.IMPORT_HELP_LINK
);
}

const matchHashComment = new RegExp(/(\/\/ .*)/, "gi");
const manifest = JSON.parse(
(await fs.readFile(webpartManifestPath, "utf8"))
(await fs.readFile(path.join(webpartsDir, webparts[0], webpartManifest), "utf8"))
.toString()
.replace(matchHashComment, "")
.trim()
Expand Down

0 comments on commit 0396ba1

Please sign in to comment.