Skip to content

Commit

Permalink
build: add preserveDirectives plugin to preserve "use client" directi…
Browse files Browse the repository at this point in the history
…ve in components
  • Loading branch information
maany committed May 5, 2024
1 parent 4555afb commit bbbf416
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
"prettier": "^3.2.4",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"rollup-plugin-preserve-directives": "^0.4.0",
"storybook": "^8.0.8",
"tailwind-merge": "^2.2.1",
"tailwindcss": "^3.4.1",
Expand Down
3 changes: 3 additions & 0 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { glob } from "glob";
import { extname, relative } from "path";
import { fileURLToPath } from "node:url";
import { peerDependencies } from "./package.json";
import preserveDirectives from "rollup-plugin-preserve-directives";

// https://vitejs.dev/config/
export default defineConfig({
Expand Down Expand Up @@ -95,6 +96,7 @@ export default defineConfig({
output: {
assetFileNames: "assets/[name][extname]",
entryFileNames: "[name].js",
preserveModules: true,
globals: {
react: "React",
"react-dom": "ReactDOM",
Expand All @@ -103,6 +105,7 @@ export default defineConfig({
...peerDependencies,
},
},
plugins: [preserveDirectives()],
},
target: "esnext",
sourcemap: true,
Expand Down

0 comments on commit bbbf416

Please sign in to comment.