Skip to content

Commit

Permalink
Add raw plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
mayank1513 committed Dec 16, 2024
1 parent d658919 commit 9b9f4da
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 39 deletions.
1 change: 1 addition & 0 deletions packages/shared/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"@vitest/coverage-v8": "^2.1.8",
"esbuild-plugin-react18": "^0.2.5",
"esbuild-plugin-react18-css": "^0.0.4",
"esraw": "^0.0.0",
"jsdom": "^25.0.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
Expand Down
4 changes: 4 additions & 0 deletions packages/shared/src/declaration.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
declare module "*.module.css";
declare module "*.module.scss";
declare module "?raw" {
const value: string;
export default value;
}
7 changes: 6 additions & 1 deletion packages/shared/tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { defineConfig, type Options } from "tsup";
import react18Plugin from "esbuild-plugin-react18";
import cssPlugin from "esbuild-plugin-react18-css";
import { raw } from "esraw";

export default defineConfig(
(options: Options) =>
Expand All @@ -12,7 +13,11 @@ export default defineConfig(
clean: !options.watch,
bundle: true,
minify: !options.watch,
esbuildPlugins: [react18Plugin(), cssPlugin({ generateScopedName: "[folder]__[local]" })],
esbuildPlugins: [
raw(),
react18Plugin(),
cssPlugin({ generateScopedName: "[folder]__[local]" }),
],
external: ["react"],
...options,
}) as Options,
Expand Down
61 changes: 23 additions & 38 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9b9f4da

Please sign in to comment.