Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ERROR] The entry point "mock/table.ts.timestamp-1710847630001.mjs" cannot be marked as external #2762

Closed
9 of 10 tasks
sun-unc opened this issue Mar 19, 2024 · 4 comments
Closed
9 of 10 tasks
Labels
c: bug Something isn't working s: awaiting more info Additional information are requested

Comments

@sun-unc
Copy link

sun-unc commented Mar 19, 2024

Pre-Checks

Describe the bug

当我通过pnpm run dev 启动项目时,偶尔(大概率)会报错,但是项目能正常运行起来

✘ [ERROR] The entry point "mock/table.ts.timestamp-1710847630001.mjs" cannot be marked as external

Error: Build failed with 1 error:
error: The entry point "mock/table.ts.timestamp-1710847630001.mjs" cannot be marked as external
    at failureErrorWithLog (/Users/sun/Code/Vue/WebDevPractice/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:1651:15)
    at /Users/sun/Code/Vue/WebDevPractice/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:1059:25
    at runOnEndCallbacks (/Users/sun/Code/Vue/WebDevPractice/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:1486:45)
    at buildResponseToResult (/Users/sun/Code/Vue/WebDevPractice/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:1057:7)
    at /Users/sun/Code/Vue/WebDevPractice/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:1086:16
    at responseCallbacks.<computed> (/Users/sun/Code/Vue/WebDevPractice/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:704:9)
    at handleIncomingPacket (/Users/sun/Code/Vue/WebDevPractice/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:764:9)
    at Socket.readFromStdout (/Users/sun/Code/Vue/WebDevPractice/node_modules/.pnpm/esbuild@0.19.12/node_modules/esbuild/lib/main.js:680:7)
    at Socket.emit (node:events:517:28)
    at addChunk (node:internal/streams/readable:368:12) {
  errors: [Getter/Setter],
  warnings: [Getter/Setter]

Minimal reproduction code

/mock/table.ts

import { defineMock } from "vite-plugin-mock-dev-server";
import { faker } from "@faker-js/faker";

const data = [
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
  {
    date: faker.date.past(),
    name: faker.internet.userName(),
    address: faker.location.city(),
  },
];
export default defineMock({
  url: "/api/table",
  body: ({ body: { page, pageSize } }) => {
    return {
      total: data.length,
      data: data.slice((page - 1) * pageSize, page * pageSize),
    };
  },
  delay: 1000,
});

Additional Context

No response

Environment Info

- OS:MacOS M1
- Node:v18.19.1
- packageManager:pnpm
- vite:^5.0.12
- faker-js/faker: ^8.4.1
- vite-plugin-mock-dev-server: ^1.4.7

Which module system do you use?

  • CJS
  • ESM

Used Package Manager

pnpm

@sun-unc sun-unc added c: bug Something isn't working s: pending triage Pending Triage labels Mar 19, 2024
@ST-DDT
Copy link
Member

ST-DDT commented Mar 19, 2024

Which version of Faker are you using?

@sun-unc
Copy link
Author

sun-unc commented Mar 21, 2024

Which version of Faker are you using?

"@faker-js/faker": "^8.4.1"

@xDivisionByZerox
Copy link
Member

I cannot reproduce this. The code provided in your "Minimal reproduction code" does nothing (do I need to build something?, must this be run in a vite project?, etc.). Please read how to create a minimal, reproducible Example or Wtf is a minimum reproduction?.
Additionally, you might want to provide a Stackblitz link. This way we simply need to click a link to help you.

@xDivisionByZerox xDivisionByZerox added s: awaiting more info Additional information are requested and removed s: pending triage Pending Triage labels Mar 23, 2024
@ST-DDT
Copy link
Member

ST-DDT commented Apr 1, 2024

Closing this as not reproducible.
If a reproduction is provided we can reopen this.

@ST-DDT ST-DDT closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bug Something isn't working s: awaiting more info Additional information are requested
Projects
None yet
Development

No branches or pull requests

3 participants