Describe the bug
Every 12.4.0-alpha.* daily build of @azure/storage-common ships a dist/commonjs/crc64.js whose final line is:
export default NativeCRC64;
That file lives under dist/commonjs/ and the package's nearest package.json does not set "type": "module", so Node loads it as CommonJS. ESM export syntax in a CJS file throws at parse time:
SyntaxError: Unexpected token 'export'
at wrapSafe (node:internal/modules/cjs/loader:1740:18)
...
at Object.<anonymous> (.../node_modules/@azure/storage-common/dist/commonjs/StorageCRC64Calculator.js:33:28)
The crash cascades up through StorageCRC64Calculator.js → StructuredMessageEncoding.js → StructuredMessageEncodingStream.js → index.js, and then through every package that depends on @azure/storage-common (including @azure/storage-blob, and transitively @azure/playwright alphas). Result: nothing depending on alpha storage-common can be loaded under Node CJS.
This is a build-pipeline regression — StorageCRC64Calculator.js consumes it as CJS:
var import_crc64 = __toESM(require("./crc64.js"));
so the file must export with module.exports = NativeCRC64;. The script that copies crc64.js into dist/commonjs/ (looks like copyJSFiles.cjs from the package's build scripts) is leaving the original ESM export default statement in place instead of rewriting it.
Also worth flagging: the latest dist-tag on the Azure SDK internal feed currently points at an alpha (latest: 12.4.0-alpha.20260312.1) rather than the real stable 12.3.0. Public npm correctly tags latest: 12.3.0, so end customers are unaffected — but anyone consuming the internal feed gets a broken "latest".
To Reproduce
Steps to reproduce the behavior:
-
In a clean folder:
mkdir repro && cd repro
npm init -y
npm install @azure/storage-common@12.4.0-alpha.20260603.3 \
--registry=https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js/npm/registry/
-
Try to load the package:
node -e "require('@azure/storage-common')"
-
Observe the SyntaxError: Unexpected token 'export' originating from node_modules/@azure/storage-common/dist/commonjs/crc64.js:2928.
-
Same failure repros via any consumer — e.g. installing alpha @azure/playwright@1.1.6-alpha.20260604.3 and running npx playwright test crashes during reporter load with the same stack.
Inspect the file directly to confirm the malformed export:
tail -n 6 node_modules/@azure/storage-common/dist/commonjs/crc64.js
Output ends with export default NativeCRC64;.
Expected behavior
dist/commonjs/crc64.js should be a valid CommonJS module — its last line should be module.exports = NativeCRC64; (matching what StorageCRC64Calculator.js requires via __toESM(require("./crc64.js"))).
The corresponding ESM copy at dist/esm/crc64.js (or wherever the ESM build emits) can keep export default NativeCRC64;.
Additionally, the internal feed's latest dist-tag for @azure/storage-common should track stable 12.3.0, not an alpha.
Screenshots / Additional context
Local workaround until the daily build is fixed — patch the one line in dist/commonjs/crc64.js:
- export default NativeCRC64;
+ module.exports = NativeCRC64;
(Easily automated with patch-package.)
12.4.0-alpha.*daily since at least 12.4.0-alpha.20260312.1 — ~3 months of broken dailies)Describe the bug
Every
12.4.0-alpha.*daily build of@azure/storage-commonships adist/commonjs/crc64.jswhose final line is:That file lives under
dist/commonjs/and the package's nearestpackage.jsondoes not set"type": "module", so Node loads it as CommonJS. ESMexportsyntax in a CJS file throws at parse time:The crash cascades up through
StorageCRC64Calculator.js→StructuredMessageEncoding.js→StructuredMessageEncodingStream.js→index.js, and then through every package that depends on@azure/storage-common(including@azure/storage-blob, and transitively@azure/playwrightalphas). Result: nothing depending on alphastorage-commoncan be loaded under Node CJS.This is a build-pipeline regression —
StorageCRC64Calculator.jsconsumes it as CJS:so the file must export with
module.exports = NativeCRC64;. The script that copiescrc64.jsintodist/commonjs/(looks likecopyJSFiles.cjsfrom the package's build scripts) is leaving the original ESMexport defaultstatement in place instead of rewriting it.Also worth flagging: the
latestdist-tag on the Azure SDK internal feed currently points at an alpha (latest: 12.4.0-alpha.20260312.1) rather than the real stable12.3.0. Public npm correctly tagslatest: 12.3.0, so end customers are unaffected — but anyone consuming the internal feed gets a broken "latest".To Reproduce
Steps to reproduce the behavior:
In a clean folder:
Try to load the package:
node -e "require('@azure/storage-common')"Observe the
SyntaxError: Unexpected token 'export'originating fromnode_modules/@azure/storage-common/dist/commonjs/crc64.js:2928.Same failure repros via any consumer — e.g. installing alpha
@azure/playwright@1.1.6-alpha.20260604.3and runningnpx playwright testcrashes during reporter load with the same stack.Inspect the file directly to confirm the malformed export:
Output ends with
export default NativeCRC64;.Expected behavior
dist/commonjs/crc64.jsshould be a valid CommonJS module — its last line should bemodule.exports = NativeCRC64;(matching whatStorageCRC64Calculator.jsrequires via__toESM(require("./crc64.js"))).The corresponding ESM copy at
dist/esm/crc64.js(or wherever the ESM build emits) can keepexport default NativeCRC64;.Additionally, the internal feed's
latestdist-tag for@azure/storage-commonshould track stable12.3.0, not an alpha.Screenshots / Additional context
Local workaround until the daily build is fixed — patch the one line in
dist/commonjs/crc64.js:(Easily automated with
patch-package.)