Skip to content

Commit

Permalink
fix(experimental-extractor): fix ERR_IMPORT_ASSERTION_TYPE_MISSING is…
Browse files Browse the repository at this point in the history
…sue (#1775)
  • Loading branch information
thekip committed Oct 3, 2023
1 parent e7a36d1 commit efcd405
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 11 additions & 1 deletion packages/cli/src/extract-experimental/buildExternalizeFilter.ts
@@ -1,3 +1,5 @@
import fs from "node:fs"

type PackageJson = {
dependencies?: Record<string, string>
devDependencies?: Record<string, string>
Expand Down Expand Up @@ -56,5 +58,13 @@ export async function getPackageJson(rootDir: string): Promise<PackageJson> {
)
}

return await import(packageJsonPath)
try {
return JSON.parse(await fs.promises.readFile(packageJsonPath, "utf-8"))
} catch (e) {
throw new Error(
`Unable to read package.json file at path ${packageJsonPath}. \n\n Error: ${
(e as Error).message
}`
)
}
}
4 changes: 1 addition & 3 deletions packages/cli/test/index.test.ts
Expand Up @@ -119,9 +119,7 @@ describe("E2E Extractor Test", () => {
compareFolders(actualPath, expectedPath)
})

const skipOnWindows = os.platform().startsWith("win")
? describe.skip
: describe
const skipOnWindows = os.platform() === "win32" ? describe.skip : describe

skipOnWindows("extractor-experimental", () => {
it("should extract to template when --template passed", async () => {
Expand Down

1 comment on commit efcd405

@vercel
Copy link

@vercel vercel bot commented on efcd405 Oct 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.