Skip to content

Commit fc6a5db

Browse files
authored
Merge pull request #3 from react18-tools/fix-autoimport
Fix autoimport
2 parents c304b3d + 5f6b140 commit fc6a5db

File tree

6 files changed

+18
-4
lines changed

6 files changed

+18
-4
lines changed

lib/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# esbuild-raw-plugin
22

3+
## 0.1.1
4+
5+
### Patch Changes
6+
7+
- c32902e: Fix a bug in autoimport logic
8+
39
## 0.1.0
410

511
### Minor Changes

lib/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "esbuild-raw-plugin",
33
"author": "Mayank Kumar Chaudhari <https://mayank-chaudhari.vercel.app>",
44
"private": false,
5-
"version": "0.1.0",
5+
"version": "0.1.1",
66
"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.",
77
"license": "MPL-2.0",
88
"main": "./dist/index.js",

lib/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export const raw: (options?: RawPluginOptions) => Plugin = options => ({
4040
});
4141
build.onLoad({ filter: /\?raw$/, namespace: "raw" }, args => {
4242
let filePath = args.pluginData;
43-
if (fs.lstatSync(filePath).isDirectory()) filePath += path.sep + "index";
43+
if (fs.existsSync(filePath) && fs.lstatSync(filePath).isDirectory())
44+
filePath += path.sep + "index";
4445
if (!fs.existsSync(filePath))
4546
for (const e of ext)
4647
if (fs.existsSync(filePath + "." + e)) {

packages/shared/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# @repo/shared
22

3+
## 0.0.2
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [c32902e]
8+
9+
310
## 0.0.1
411

512
### Patch Changes

packages/shared/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@repo/shared",
3-
"version": "0.0.1",
3+
"version": "0.0.2",
44
"private": true,
55
"sideEffects": false,
66
"main": "./dist/index.js",

packages/shared/src/client/demo/demo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import styles from "./demo.module.scss";
44
import { LiveProvider, LiveEditor, LivePreview } from "react-live";
55
import { Dots1, Dots2, Bars1, Bars2 } from "react18-loaders/dist/server";
66
import text from "./index.ts?raw";
7-
import code from "./loader-demo.tsx?raw";
7+
import code from "./loader-demo?raw";
88

99
/** React live demo */
1010
export function Demo() {

0 commit comments

Comments
 (0)