From 67a4abc49ec8ea451d5e67edbca0d3007ea51ac7 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:47:55 -0700 Subject: [PATCH 1/6] Export types first --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 3bfc4fa..9792673 100644 --- a/package.json +++ b/package.json @@ -16,13 +16,13 @@ "author": "Laravel", "exports": { ".": { + "types": "./dist/index.d.ts", "import": "./dist/index.mjs", - "require": "./dist/index.cjs", - "types": "./dist/index.d.ts" + "require": "./dist/index.cjs" }, "./inertia-helpers": { - "import": "./inertia-helpers/index.js", "types": "./inertia-helpers/index.d.ts", + "import": "./inertia-helpers/index.js", "node": "./inertia-helpers/index.js" } }, From 9a27477e137cd119141c14aa96f421b790ff55d3 Mon Sep 17 00:00:00 2001 From: Ben McCann <322311+benmccann@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:53:24 -0700 Subject: [PATCH 2/6] Drop CJS build --- package.json | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 9792673..d7b5fee 100644 --- a/package.json +++ b/package.json @@ -17,13 +17,11 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "import": "./dist/index.mjs", - "require": "./dist/index.cjs" + "default": "./dist/index.mjs" }, "./inertia-helpers": { "types": "./inertia-helpers/index.d.ts", - "import": "./inertia-helpers/index.js", - "node": "./inertia-helpers/index.js" + "default": "./inertia-helpers/index.js" } }, "types": "./dist/index.d.ts", From 0c55436cd590eecc86878562fefb589bf5dd5a0a Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Mon, 7 Aug 2023 12:42:31 +1000 Subject: [PATCH 3/6] Remove CJS build step --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index d7b5fee..62b0f04 100644 --- a/package.json +++ b/package.json @@ -31,9 +31,8 @@ ], "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-inertia-helpers": "rm -rf inertia-helpers && tsc --project tsconfig.inertia-helpers.json", "lint": "eslint --ext .ts ./src ./tests", From a1967fcc8634a4395c010c217c58777860a5aae7 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Wed, 9 Aug 2023 12:56:29 +1000 Subject: [PATCH 4/6] Use `"type": "module"` in the project --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 62b0f04..ce474d8 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ }, "license": "MIT", "author": "Laravel", + "type": "module", "exports": { ".": { "types": "./dist/index.d.ts", From fdcb33cddfdfcf132b607a3439209fcdf75c5f64 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Wed, 9 Aug 2023 12:56:48 +1000 Subject: [PATCH 5/6] Remove `mjs` extension from build output --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ce474d8..6e0fa50 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "exports": { ".": { "types": "./dist/index.d.ts", - "default": "./dist/index.mjs" + "default": "./dist/index.js" }, "./inertia-helpers": { "types": "./inertia-helpers/index.d.ts", @@ -34,7 +34,7 @@ "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 && cp src/dev-server-index.html dist/", "build-plugin-types": "tsc --emitDeclarationOnly", - "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" From c781bf150899b4275feb5b108bde528410656e54 Mon Sep 17 00:00:00 2001 From: Tim MacDonald Date: Wed, 9 Aug 2023 13:04:23 +1000 Subject: [PATCH 6/6] Fix ESLint configuration which does not support ESM --- .eslintrc.js => .eslintrc.cjs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .eslintrc.js => .eslintrc.cjs (100%) diff --git a/.eslintrc.js b/.eslintrc.cjs similarity index 100% rename from .eslintrc.js rename to .eslintrc.cjs