Skip to content

[vitest-pool-worker] Add type: module in package.json#9595

Merged
petebacondarwin merged 2 commits intomainfrom
vicb/vipo-module
Jun 13, 2025
Merged

[vitest-pool-worker] Add type: module in package.json#9595
petebacondarwin merged 2 commits intomainfrom
vicb/vipo-module

Conversation

@vicb
Copy link
Copy Markdown
Contributor

@vicb vicb commented Jun 13, 2025

Building vitest-pool-worker fails for some Node version (i.e. 22.5.1, 20.18.1).

@cloudflare/vitest-pool-workers:build: file:///Users/vberchet/code/work/workers-sdk/packages/vitest-pool-workers/scripts/rtti/query.mjs:3
@cloudflare/vitest-pool-workers:build: import { StructureGroups } from "./rtti.js";
@cloudflare/vitest-pool-workers:build:          ^^^^^^^^^^^^^^^
@cloudflare/vitest-pool-workers:build: SyntaxError: Named export 'StructureGroups' not found. The requested module './rtti.js' is a CommonJS module, which may not support all module.exports as named exports.
@cloudflare/vitest-pool-workers:build: CommonJS modules can always be imported via the default export, for example using:
@cloudflare/vitest-pool-workers:build: 
@cloudflare/vitest-pool-workers:build: import pkg from './rtti.js';
@cloudflare/vitest-pool-workers:build: const { StructureGroups } = pkg;
@cloudflare/vitest-pool-workers:build: 
@cloudflare/vitest-pool-workers:build:     at ModuleJob._instantiate (node:internal/modules/esm/module_job:171:21)
@cloudflare/vitest-pool-workers:build:     at async ModuleJob.run (node:internal/modules/esm/module_job:254:5)
@cloudflare/vitest-pool-workers:build:     at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:485:26)
@cloudflare/vitest-pool-workers:build:     at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:109:5)
@cloudflare/vitest-pool-workers:build: 
@cloudflare/vitest-pool-workers:build: Node.js v22.5.1
@cloudflare/vitest-pool-workers:build:  ELIFECYCLE  Command failed with exit code 1.

Adding an explicit module type fixes the issue.

/ref #9495

/cc @jamesopstad @edmundhung


  • Tests
    • TODO (before merge)
    • Tests included
    • Tests not necessary because: depends on the installed Node version, not caught by CI but tested locally with 22.5.1
  • Wrangler / Vite E2E Tests CI Job required? (Use "e2e" label or ask maintainer to run separately)
    • I don't know
    • Required
    • Not required because:
  • Public documentation
    • TODO (before merge)
    • Cloudflare docs PR(s):
    • Documentation not necessary because: bug fix
  • Wrangler V3 Backport
    • TODO (before merge)
    • Wrangler PR:
    • Not necessary because: in vite-pool-worker

@vicb vicb requested a review from a team as a code owner June 13, 2025 08:31
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jun 13, 2025

🦋 Changeset detected

Latest commit: e8a2f2e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@cloudflare/vitest-pool-workers Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Jun 13, 2025
@vicb vicb added the e2e Run wrangler + vite-plugin e2e tests on a PR label Jun 13, 2025
@github-project-automation github-project-automation bot moved this from Untriaged to Approved in workers-sdk Jun 13, 2025
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Jun 13, 2025

create-cloudflare

npm i https://pkg.pr.new/create-cloudflare@9595

@cloudflare/kv-asset-handler

npm i https://pkg.pr.new/@cloudflare/kv-asset-handler@9595

miniflare

npm i https://pkg.pr.new/miniflare@9595

@cloudflare/pages-shared

npm i https://pkg.pr.new/@cloudflare/pages-shared@9595

@cloudflare/unenv-preset

npm i https://pkg.pr.new/@cloudflare/unenv-preset@9595

@cloudflare/vite-plugin

npm i https://pkg.pr.new/@cloudflare/vite-plugin@9595

@cloudflare/vitest-pool-workers

npm i https://pkg.pr.new/@cloudflare/vitest-pool-workers@9595

@cloudflare/workers-editor-shared

npm i https://pkg.pr.new/@cloudflare/workers-editor-shared@9595

wrangler

npm i https://pkg.pr.new/wrangler@9595

commit: e8a2f2e

@petebacondarwin petebacondarwin added this pull request to the merge queue Jun 13, 2025
Merged via the queue into main with commit 9793e5b Jun 13, 2025
19 of 21 checks passed
@petebacondarwin petebacondarwin deleted the vicb/vipo-module branch June 13, 2025 09:01
@github-project-automation github-project-automation bot moved this from Approved to Done in workers-sdk Jun 13, 2025
jseba added a commit to jseba/workers-sdk that referenced this pull request Jun 14, 2025
* 'main' of ssh://github.com/cloudflare/workers-sdk: (213 commits)
  fix(vite-plugin-cloudflare): allow unknown entrypoint on startup (cloudflare#9583)
  add warning about env not specified to potentially risky wrangler commands (cloudflare#9344)
  test: correctly delete test d1 databases (cloudflare#9598)
  Add details to v3 maintenance worflow error message (cloudflare#9602)
  drop unused `WRANGLER_UNENV_RESOLVE_PATHS` env var (cloudflare#9593)
  warn instead of erroring if no exposed ports. and remove unused dev_exposed_ports (cloudflare#9573)
  fix(wrangler): point to the right doc location (replaces cloudflare#9353) (cloudflare#9592)
  [vitest-pool-worker] Add `type: module` in package.json (cloudflare#9595)
  Enable HTML handling for HTML files in the public directory (cloudflare#9548)
  switch from go container to js (cloudflare#9588)
  containers: switch to Cloudflare container registry (cloudflare#9564)
  performance improvement: restart a mixed mode session only if the worker's remote bindings have changed (cloudflare#9536)
  ci: delete more orphaned resources from e2e tests (cloudflare#9580)
  test: remove `verifyBuildScript` logic from c3 e2e tests (cloudflare#9504)
  fix(vite-plugin): ensure node compat globals are injected before any imports (cloudflare#9581)
  feat(containers-shared): Move `isDockerfile` utility function to `containers-shared` (cloudflare#9577)
  allow `startWorker` to accept `false` as an `inspector` option (to disable the inspector server) (cloudflare#9550)
  Update capnp generated code from the workerd.capnp (cloudflare#9582)
  Bump `@cloudflare/unenv-preset` to 2.3.3 (cloudflare#9566)
  test: make custom build bundling tests more robust (cloudflare#9494)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e2e Run wrangler + vite-plugin e2e tests on a PR

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants