Skip to content

Commit

Permalink
[1.0] Drop CJS build and export types first (#235)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
benmccann and timacdonald authored Aug 9, 2023
1 parent f89fcde commit d3c3869
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
File renamed without changes.
14 changes: 6 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,15 @@
},
"license": "MIT",
"author": "Laravel",
"type": "module",
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.cjs",
"types": "./dist/index.d.ts"
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
},
"./inertia-helpers": {
"import": "./inertia-helpers/index.js",
"types": "./inertia-helpers/index.d.ts",
"node": "./inertia-helpers/index.js"
"default": "./inertia-helpers/index.js"
}
},
"types": "./dist/index.d.ts",
Expand All @@ -33,10 +32,9 @@
],
"scripts": {
"build": "npm run build-plugin && npm run build-inertia-helpers",
"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/",
"build-plugin": "rm -rf dist && npm run build-plugin-types && npm run build-plugin-esm && cp src/dev-server-index.html dist/",
"build-plugin-types": "tsc --emitDeclarationOnly",
"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",
"build-plugin-esm": "esbuild src/index.ts --platform=node --format=esm --outfile=dist/index.mjs",
"build-plugin-esm": "esbuild src/index.ts --platform=node --format=esm --outfile=dist/index.js",
"build-inertia-helpers": "rm -rf inertia-helpers && tsc --project tsconfig.inertia-helpers.json",
"lint": "eslint --ext .ts ./src ./tests",
"test": "vitest run"
Expand Down

0 comments on commit d3c3869

Please sign in to comment.