Skip to content

Commit 34bfba0

Browse files
committed
fix auto-import from file
1 parent c304b3d commit 34bfba0

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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/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)