Skip to content

Commit

Permalink
add use client to generated output
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed May 14, 2023
1 parent 5f215a5 commit d9e8c13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"build": "npm run clean && npm run build:core && npm run pack-and-extract && npm run build:addons && npm run style && husky install",
"build:core": "microbundle --jsx React.createElement --jsxFragment React.Fragment",
"build:addons": "node build-addons.mjs",
"postbuild": "./prepend-use-client.sh",
"setup": "npm run clean && npm run build && npm run pack-and-extract",
"pack-and-extract": "yarn pack -f react-toastify.tgz && npm run rm-pkg && npm run extract-pkg",
"rm-pkg": "rimraf node_modules/react-toastify && mkdir -p node_modules/react-toastify",
Expand Down
8 changes: 8 additions & 0 deletions prepend-use-client.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

# TODO yeah maybe let's make something more robust and futur proof
files=("react-toastify.js" "react-toastify.esm.mjs" "inject-style.js" "inject-style.esm.mjs")

for f in ${files[*]}; do
echo -e "'use client';\n$(cat ./dist/${f})" > ./dist/${f}
done

0 comments on commit d9e8c13

Please sign in to comment.