diff --git a/lib/CHANGELOG.md b/lib/CHANGELOG.md index e2d12347..7e62e30a 100644 --- a/lib/CHANGELOG.md +++ b/lib/CHANGELOG.md @@ -1,5 +1,11 @@ # esbuild-raw-plugin +## 0.1.1 + +### Patch Changes + +- c32902e: Fix a bug in autoimport logic + ## 0.1.0 ### Minor Changes diff --git a/lib/package.json b/lib/package.json index 5c2f26fd..83b17e26 100644 --- a/lib/package.json +++ b/lib/package.json @@ -2,7 +2,7 @@ "name": "esbuild-raw-plugin", "author": "Mayank Kumar Chaudhari ", "private": false, - "version": "0.1.0", + "version": "0.1.1", "description": "An ESBuild and TSUP plugin that allows importing files as raw text. Useful for loading code files in documentation, interactive demos, or tools like react-live.", "license": "MPL-2.0", "main": "./dist/index.js", diff --git a/lib/src/index.ts b/lib/src/index.ts index 1b3e5c50..42c19ef8 100644 --- a/lib/src/index.ts +++ b/lib/src/index.ts @@ -40,7 +40,8 @@ export const raw: (options?: RawPluginOptions) => Plugin = options => ({ }); build.onLoad({ filter: /\?raw$/, namespace: "raw" }, args => { let filePath = args.pluginData; - if (fs.lstatSync(filePath).isDirectory()) filePath += path.sep + "index"; + if (fs.existsSync(filePath) && fs.lstatSync(filePath).isDirectory()) + filePath += path.sep + "index"; if (!fs.existsSync(filePath)) for (const e of ext) if (fs.existsSync(filePath + "." + e)) { diff --git a/packages/shared/CHANGELOG.md b/packages/shared/CHANGELOG.md index 96e554d3..67b3d7f0 100644 --- a/packages/shared/CHANGELOG.md +++ b/packages/shared/CHANGELOG.md @@ -1,5 +1,12 @@ # @repo/shared +## 0.0.2 + +### Patch Changes + +- Updated dependencies [c32902e] + - esbuild-raw-plugin@0.1.1 + ## 0.0.1 ### Patch Changes diff --git a/packages/shared/package.json b/packages/shared/package.json index a431ad0e..e05776f1 100644 --- a/packages/shared/package.json +++ b/packages/shared/package.json @@ -1,6 +1,6 @@ { "name": "@repo/shared", - "version": "0.0.1", + "version": "0.0.2", "private": true, "sideEffects": false, "main": "./dist/index.js", diff --git a/packages/shared/src/client/demo/demo.tsx b/packages/shared/src/client/demo/demo.tsx index f3232b06..05a8f8a6 100644 --- a/packages/shared/src/client/demo/demo.tsx +++ b/packages/shared/src/client/demo/demo.tsx @@ -4,7 +4,7 @@ import styles from "./demo.module.scss"; import { LiveProvider, LiveEditor, LivePreview } from "react-live"; import { Dots1, Dots2, Bars1, Bars2 } from "react18-loaders/dist/server"; import text from "./index.ts?raw"; -import code from "./loader-demo.tsx?raw"; +import code from "./loader-demo?raw"; /** React live demo */ export function Demo() {