From a43263526c075ce5faa10cdc14c4835b0bb1547e Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Sun, 21 Jul 2024 18:44:07 -0400 Subject: [PATCH 1/3] fix: use ts file as entrypoint --- packages/scope/package.json | 6 +----- packages/scope/src/index.ts | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/packages/scope/package.json b/packages/scope/package.json index 7902e6b..8f69ebb 100644 --- a/packages/scope/package.json +++ b/packages/scope/package.json @@ -4,7 +4,7 @@ "description": "Get a scoped ID for whatever file you're in. Zero client-side JS.", "type": "module", "exports": { - ".": "./dist/index.js", + ".": "./src/index.ts", "./types": "./ambient.d.ts" }, "files": ["src", "ambient.d.ts"], @@ -13,10 +13,6 @@ "url": "https://github.com/bholmesdev/simple-stack.git", "directory": "packages/scope" }, - "scripts": { - "dev": "tsc --watch", - "build": "tsc" - }, "dependencies": { "typescript": "^5.5.3", "vite": "^5.0.10" diff --git a/packages/scope/src/index.ts b/packages/scope/src/index.ts index caf2592..38b63d2 100644 --- a/packages/scope/src/index.ts +++ b/packages/scope/src/index.ts @@ -1,11 +1,10 @@ import { createHash } from "node:crypto"; import type { AstroConfig } from "astro"; import { normalizePath } from "vite"; +import "../ambient.d.ts"; type VitePlugin = Required["plugins"][number]; -import "../ambient.d.ts"; - const virtualMod = "simple:scope"; export default function vitePluginSimpleScope(): VitePlugin { From 02280e72372ca940032855b0b243d938c1513982 Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Sun, 21 Jul 2024 18:44:54 -0400 Subject: [PATCH 2/3] chore: remove `/types` callout from readme --- www/src/content/docs/scope.md | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/www/src/content/docs/scope.md b/www/src/content/docs/scope.md index 1ed23e9..10f7303 100644 --- a/www/src/content/docs/scope.md +++ b/www/src/content/docs/scope.md @@ -35,14 +35,7 @@ Simple scope is a vite plugin compatible with any vite-based framework (Astro, N npm i vite-plugin-simple-scope ``` -Then, set up type inferencing for the `simple:scope` module with an `env.d.ts` file. You can create this file at the base of your project, or add to the provided `src/env.d.ts` file for frameworks like Astro: - -```ts -// env.d.ts -/// -``` - -Finally, apply as a vite plugin in your framework of choice: +Then, apply as a vite plugin in your framework of choice: ```js import simpleScope from 'vite-plugin-simple-scope'; From 7ff6c6dc2f1aae9b26f574ec93aef1cc8014495b Mon Sep 17 00:00:00 2001 From: bholmesdev Date: Sun, 21 Jul 2024 18:46:01 -0400 Subject: [PATCH 3/3] chore: changeset --- .changeset/fluffy-peas-jump.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/fluffy-peas-jump.md diff --git a/.changeset/fluffy-peas-jump.md b/.changeset/fluffy-peas-jump.md new file mode 100644 index 0000000..8078577 --- /dev/null +++ b/.changeset/fluffy-peas-jump.md @@ -0,0 +1,5 @@ +--- +"vite-plugin-simple-scope": patch +--- + +fixes "failed to resolve entry" error on dev server start.