Skip to content

Commit d3c3869

Browse files
[1.0] Drop CJS build and export types first (#235)
* Export types first * Drop CJS build * Remove CJS build step * Use `"type": "module"` in the project * Remove `mjs` extension from build output * Fix ESLint configuration which does not support ESM --------- Co-authored-by: Tim MacDonald <hello@timacdonald.me>
1 parent f89fcde commit d3c3869

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed
File renamed without changes.

package.json

+6-8
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@
1414
},
1515
"license": "MIT",
1616
"author": "Laravel",
17+
"type": "module",
1718
"exports": {
1819
".": {
19-
"import": "./dist/index.mjs",
20-
"require": "./dist/index.cjs",
21-
"types": "./dist/index.d.ts"
20+
"types": "./dist/index.d.ts",
21+
"default": "./dist/index.js"
2222
},
2323
"./inertia-helpers": {
24-
"import": "./inertia-helpers/index.js",
2524
"types": "./inertia-helpers/index.d.ts",
26-
"node": "./inertia-helpers/index.js"
25+
"default": "./inertia-helpers/index.js"
2726
}
2827
},
2928
"types": "./dist/index.d.ts",
@@ -33,10 +32,9 @@
3332
],
3433
"scripts": {
3534
"build": "npm run build-plugin && npm run build-inertia-helpers",
36-
"build-plugin": "rm -rf dist && npm run build-plugin-types && npm run build-plugin-esm && npm run build-plugin-cjs && cp src/dev-server-index.html dist/",
35+
"build-plugin": "rm -rf dist && npm run build-plugin-types && npm run build-plugin-esm && cp src/dev-server-index.html dist/",
3736
"build-plugin-types": "tsc --emitDeclarationOnly",
38-
"build-plugin-cjs": "esbuild src/index.ts --platform=node --format=cjs --outfile=dist/index.cjs --define:import.meta.url=import_meta_url --inject:./import.meta.url-polyfill.js",
39-
"build-plugin-esm": "esbuild src/index.ts --platform=node --format=esm --outfile=dist/index.mjs",
37+
"build-plugin-esm": "esbuild src/index.ts --platform=node --format=esm --outfile=dist/index.js",
4038
"build-inertia-helpers": "rm -rf inertia-helpers && tsc --project tsconfig.inertia-helpers.json",
4139
"lint": "eslint --ext .ts ./src ./tests",
4240
"test": "vitest run"

0 commit comments

Comments
 (0)