Skip to content

Commit

Permalink
feat: add "use client" directive for Next.js apps
Browse files Browse the repository at this point in the history
  • Loading branch information
letehaha authored and dr497 committed Dec 7, 2023
1 parent 1a29037 commit 7d6e10b
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 73 deletions.
163 changes: 96 additions & 67 deletions package-lock.json

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

11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bonfida/sns-widget",
"version": "0.0.4",
"version": "0.0.5",
"description": "SNS Widget for 3rd-party apps for quick domain search and register",
"repository": {
"type": "git",
Expand Down Expand Up @@ -50,20 +50,21 @@
"@rollup/plugin-babel": "^6.0.4",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@types/react": "^18.2.41",
"@types/react": "^18.2.42",
"@types/react-dom": "^18.2.17",
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@vitejs/plugin-react": "^4.2.0",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.16",
"eslint": "^8.55.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"gh-pages": "^6.1.0",
"postcss": "^8.4.32",
"prettier": "3.1.0",
"rollup-plugin-banner2": "^1.2.2",
"tailwind-merge": "^2.1.0",
"tailwindcss": "^3.3.5",
"tailwindcss": "^3.3.6",
"typescript": "^5.3.2",
"vite": "^4.5.0",
"vite-bundle-visualizer": "^0.11.0",
Expand All @@ -73,7 +74,7 @@
"dependencies": {
"@bonfida/emojis": "^1.0.2",
"@bonfida/sns-react": "^2.0.2",
"@bonfida/spl-name-service": "2.0.1",
"@bonfida/spl-name-service": "2.0.3",
"@pythnetwork/client": "^2.19.0",
"@solana/wallet-adapter-react": "^0.15",
"@solana/wallet-adapter-react-ui": "^0.9",
Expand Down
2 changes: 2 additions & 0 deletions src/lib/index.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use client";

import "./index.css";

import { useState, lazy, Suspense } from "react";
Expand Down
7 changes: 6 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { nodePolyfills } from "vite-plugin-node-polyfills";
import terser from "@rollup/plugin-terser";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import babel from "@rollup/plugin-babel";
import banner2 from "rollup-plugin-banner2";

const resolvePath = (str: string) => path.resolve(__dirname, str);

Expand Down Expand Up @@ -50,7 +51,11 @@ export default defineConfig(({ mode }) => {
"@pythnetwork/client": "@pythnetwork/client",
},
},
plugins: [terser({ compress: true })],
plugins: [
terser({ compress: true }),
// Need it for Next.js
banner2(() => `"use client";`),
],
},
},
plugins: [
Expand Down

0 comments on commit 7d6e10b

Please sign in to comment.