Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix simple-scope entry issue #70

Merged
merged 3 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/fluffy-peas-jump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"vite-plugin-simple-scope": patch
---

fixes "failed to resolve entry" error on dev server start.
6 changes: 1 addition & 5 deletions packages/scope/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand All @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions packages/scope/src/index.ts
Original file line number Diff line number Diff line change
@@ -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<AstroConfig["vite"]>["plugins"][number];

import "../ambient.d.ts";

const virtualMod = "simple:scope";

export default function vitePluginSimpleScope(): VitePlugin {
Expand Down
9 changes: 1 addition & 8 deletions www/src/content/docs/scope.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
/// <reference types="vite-plugin-simple-scope/types" />
```

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';
Expand Down
Loading