You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@analytics/core: require("@analytics/core/client") fails because dist/client/core.js is CommonJS under "type": "module" #526
require("@analytics/core/client") throws in Node.js because packages/analytics-core/package.json sets "type": "module" while exports["./client"].require points to ./dist/client/core.js, which is a CommonJS bundle.
root: function
...
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '.../node_modules/@analytics/core/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
(import { Analytics } from "@analytics/core/client" works because exports["./client"].import resolves to ./dist/client/core.module.js.)
Expected output:
root: function
client: function
packages/analytics-core/server/package.json renames its CommonJS output to analytics-core.cjs for exports["."].require (follow-up to #501), whereas client/package.json leaves ./dist/client/core.js with a .js extension (and packages/analytics-core/package.json"files" only lists dist/**/*.js, so dist/**/*.cjs is also needed for dist/client/core.cjs to be included in the published tarball).
Tested on @analytics/core@0.13.2 (npm latest) and master (6a5b895) with Node.js v26.13.0 and v24.22.2.
Activity