# Migrating to js-queue 3.1 Version 3.1 keeps the queue API and loading syntax while changing the runtime baseline and internal state implementation. ## Move Node to 22.13 or newer Both `import` and `require` now load the same synchronous ES module. CommonJS syntax remains unchanged: ```js const Queue=require('js-queue'); const Stack=require('js-queue/stack'); ``` Upgrade Node before installing js-queue 3.1. The package no longer ships duplicate `.cjs` runtime files or supports Node releases older than 22.13. The queue now stores private state directly on each instance instead of performing WeakMap lookups. The public `contents`, `size`, `running`, `autoRun`, and `stop` contracts are unchanged. Browser builds now require native private class fields. ## Earlier migration: js-queue 2 to 3.0 Version 3 keeps the explicit FIFO contract while modernizing modules, package boundaries, validation, testing, and documentation. ## Choose an entry point `js-queue` works with bundlers and without a bundler. Bundlers resolve the bare imports below normally. Native browser ESM needs the complete import map shown in the [browser guide](./browser/index.html), placed before the module script; it does not need a build, transpiler, or bundler. New ESM code should import the primary package: ```js import Queue from 'js-queue'; ``` Existing CommonJS code can remain unchanged: ```js const Queue=require('js-queue'); ``` The compatibility deep path also resolves by module format: ```js import Queue from 'js-queue/queue.js'; const Queue=require('js-queue/queue.js'); ``` For a classic browser script, continue loading the dedicated global build: ```html ``` Do not load the ESM `queue.js` file as a classic script. Use `