Repository: tatethurston/nextjs-routes (ts)

Issue:
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module needs an import assertion of type "json"
Error Occurred:
![image](https://user-images.githubusercontent.com/65409152/210753093-387299b8-6421-4e2b-be30-fd7519dd7615.png)

To Reproduce this problem:

1. Use Module as project `type`
```js
   "type": "module"
```

2. Run `dev`

Pull request:
remove package.json import
fixes #115

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 27d9ae7..3b36557 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,8 +1,12 @@
 # Changelog
 
+## 1.0.7
+
+- Remove package.json version import. This resolves `TypeError[ERR_IMPORT_ASSERTION_TYPE_MISSING]`. [See #115](https://github.com/tatethurston/nextjs-routes/issues/115) for more context.
+
 ## 1.0.6
 
-Fix bad publish of 1.0.5
+- Fix bad publish of 1.0.5
 
 ## 1.0.5
 
diff --git a/examples/app/.vscode/settings.json b/examples/app/.vscode/settings.json
deleted file mode 100644
index fae8e3d..0000000
--- a/examples/app/.vscode/settings.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
-  "typescript.tsdk": "node_modules/typescript/lib",
-  "typescript.enablePromptUseWorkspaceTsdk": true
-}
diff --git a/examples/app/nextjs-routes.d.ts b/examples/app/nextjs-routes.d.ts
index fab1d69..4fd6109 100644
--- a/examples/app/nextjs-routes.d.ts
+++ b/examples/app/nextjs-routes.d.ts
@@ -1,5 +1,6 @@
 // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
diff --git a/examples/intl/nextjs-routes.d.ts b/examples/intl/nextjs-routes.d.ts
index 914937f..d6b017f 100644
--- a/examples/intl/nextjs-routes.d.ts
+++ b/examples/intl/nextjs-routes.d.ts
@@ -1,5 +1,6 @@
 // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
diff --git a/examples/intl/package.json b/examples/intl/package.json
index 50ef008..5f801b1 100644
--- a/examples/intl/package.json
+++ b/examples/intl/package.json
@@ -2,6 +2,7 @@
   "name": "intl",
   "version": "0.0.1",
   "private": true,
+  "type": "module",
   "scripts": {
     "dev": "next dev",
     "build": "next build",
diff --git a/examples/typescript/types/nextjs-routes.d.ts b/examples/typescript/types/nextjs-routes.d.ts
index 6947faf..16e11fd 100644
--- a/examples/typescript/types/nextjs-routes.d.ts
+++ b/examples/typescript/types/nextjs-routes.d.ts
@@ -1,6 +1,6 @@
 // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
diff --git a/package.json b/package.json
index de96970..db19e9e 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
 {
   "private": true,
   "name": "nextjs-routes-development",
-  "version": "1.0.6",
+  "version": "1.0.7",
   "license": "MIT",
   "author": "Tate <tatethurston@gmail.com>",
   "repository": {
diff --git a/public.package.json b/public.package.json
index 80a9dad..113c5fc 100644
--- a/public.package.json
+++ b/public.package.json
@@ -1,6 +1,6 @@
 {
   "name": "nextjs-routes",
-  "version": "1.0.6",
+  "version": "1.0.7",
   "description": "Type safe routing for Next.js",
   "license": "MIT",
   "author": "Tate <tatethurston@gmail.com>",
diff --git a/src/core.ts b/src/core.ts
index c89dff5..a7935ae 100644
--- a/src/core.ts
+++ b/src/core.ts
@@ -2,7 +2,13 @@ import { existsSync, mkdirSync, writeFileSync } from "fs";
 import { I18NConfig } from "next/dist/server/config-shared.js";
 import { join, parse, sep } from "path";
 import { findFiles, getAppDirectory, getPagesDirectory } from "./utils.js";
-import * as pkg from "../package.json";
+
+// import assertions are not yet supported by babel out of the box but are required
+// by node 17+
+// import pkg from "../package.json" assert { type: "json" };
+const pkg = {
+  version: "1.0.7",
+};
 
 type QueryType = "dynamic" | "catch-all" | "optional-catch-all";
 
diff --git a/tsconfig.json b/tsconfig.json
index 0d79ced..d45b4d0 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,6 +1,8 @@
 {
   "compilerOptions": {
     "allowJs": true,
+    "allowSyntheticDefaultImports": true,
+    "declaration": true,
     "forceConsistentCasingInFileNames": true,
     "isolatedModules": true,
     "module": "esnext",
@@ -12,7 +14,6 @@
     "skipLibCheck": true,
     "sourceMap": false,
     "strict": true,
-    "declaration": true,
     "target": "ES2020"
   },
   "include": ["package.json", "src/**/*"]


Test patch:
diff --git a/e2e/nextjs-routes.d.ts b/e2e/nextjs-routes.d.ts
index def9fbc..3d56d88 100644
--- a/e2e/nextjs-routes.d.ts
+++ b/e2e/nextjs-routes.d.ts
@@ -1,6 +1,6 @@
 // THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
diff --git a/src/__snapshots__/core.test.ts.snap b/src/__snapshots__/core.test.ts.snap
index 07725e3..508e079 100644
--- a/src/__snapshots__/core.test.ts.snap
+++ b/src/__snapshots__/core.test.ts.snap
@@ -6,7 +6,7 @@ exports[`route generation app directory (experimental) 1`] = `
     "nextjs-routes.d.ts",
     "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
@@ -140,7 +140,7 @@ exports[`route generation configuration i18n 1`] = `
     "nextjs-routes.d.ts",
     "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
@@ -292,7 +292,7 @@ exports[`route generation configuration outDir 1`] = `
     "src/nextjs-routes.d.ts",
     "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
@@ -424,7 +424,7 @@ exports[`route generation configuration pageExtensions configured 1`] = `
     "nextjs-routes.d.ts",
     "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
@@ -558,7 +558,7 @@ exports[`route generation configuration pageExtensions default 1`] = `
     "nextjs-routes.d.ts",
     "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
@@ -690,7 +690,7 @@ exports[`route generation dedupes 1`] = `
     "nextjs-routes.d.ts",
     "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
@@ -822,7 +822,7 @@ exports[`route generation no routes 1`] = `
     "nextjs-routes.d.ts",
     "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
@@ -954,7 +954,7 @@ exports[`route generation transforms windows paths 1`] = `
     "nextjs-routes.d.ts",
     "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore
@@ -1086,7 +1086,7 @@ exports[`route generation typescript 1`] = `
     "nextjs-routes.d.ts",
     "// THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
 // This file will be automatically regenerated when your Next.js server is running.
-// nextjs-routes version: 1.0.6
+// nextjs-routes version: 1.0.7
 /* eslint-disable */
 
 // prettier-ignore