Skip to content

Commit 179bb95

Browse files
committed
fixed #292
1 parent 5885900 commit 179bb95

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
correctly skipped instead of being parsed as `HorizontalSpacing` expressions
3939
wrapped in `InvisibleOperator`.
4040

41+
- **Fixed `require()` returning empty exports on Node 22+** (#292): Because the
42+
package sets `"type": "module"`, Node treated the UMD `.js` files as ESM,
43+
breaking the UMD factory pattern. The UMD builds now use a `.cjs` extension so
44+
Node always treats them as CommonJS.
45+
4146
### 0.53.0 _2026-02-21_
4247

4348
#### Runtime and Scoping

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@
4646
".": {
4747
"types": "./dist/types/compute-engine.d.ts",
4848
"import": "./dist/compute-engine.min.esm.js",
49-
"require": "./dist/compute-engine.min.umd.js",
49+
"require": "./dist/compute-engine.min.umd.cjs",
5050
"default": "./dist/compute-engine.min.esm.js"
5151
},
5252
"./math-json": {
5353
"types": "./dist/types/math-json.d.ts",
5454
"import": "./dist/math-json.min.esm.js",
55-
"require": "./dist/math-json.min.umd.js",
55+
"require": "./dist/math-json.min.umd.cjs",
5656
"default": "./dist/math-json.min.esm.js"
5757
}
5858
},

scripts/build.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ await Promise.all([
6868
esbuild.build({
6969
...BUILD_OPTIONS,
7070
entryPoints: ['./src/compute-engine.ts'],
71-
outfile: './dist/compute-engine.umd.js',
71+
outfile: './dist/compute-engine.umd.cjs',
7272
format: 'iife',
7373
...COMPUTE_ENGINE_UMD_OPTIONS,
7474
globalName: 'ComputeEngine',
@@ -84,7 +84,7 @@ await Promise.all([
8484
esbuild.build({
8585
...BUILD_OPTIONS,
8686
entryPoints: ['./src/math-json.ts'],
87-
outfile: './dist/math-json.umd.js',
87+
outfile: './dist/math-json.umd.cjs',
8888
format: 'iife',
8989
...MATH_JSON_UMD_OPTIONS,
9090
globalName: 'MathJson',
@@ -107,7 +107,7 @@ await Promise.all([
107107
pure: ['console.assert', 'console.log'],
108108
minify: true,
109109
entryPoints: ['./src/compute-engine.ts'],
110-
outfile: './dist/compute-engine.min.umd.js',
110+
outfile: './dist/compute-engine.min.umd.cjs',
111111
format: 'iife',
112112
...COMPUTE_ENGINE_UMD_OPTIONS,
113113
globalName: 'ComputeEngine',
@@ -129,7 +129,7 @@ await Promise.all([
129129
pure: ['console.assert', 'console.log'],
130130
minify: true,
131131
entryPoints: ['./src/math-json.ts'],
132-
outfile: './dist/math-json.min.umd.js',
132+
outfile: './dist/math-json.min.umd.cjs',
133133
format: 'iife',
134134
...MATH_JSON_UMD_OPTIONS,
135135
globalName: 'MathJson',

0 commit comments

Comments
 (0)