-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: temp workaround for next-js esm
- Loading branch information
1 parent
62ae899
commit 26800ee
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import fs from "fs-extra" | ||
|
||
// get all mjs files in the dist folder | ||
const files = await fs.readdir("dist") | ||
|
||
// read the content of files that end with .mjs | ||
const mjsFiles = files.filter((file) => file.endsWith(".mjs")) | ||
|
||
// replace the content of the files | ||
await Promise.all( | ||
mjsFiles.map(async (file) => { | ||
const content = fs.readFileSync(`dist/${file}`, "utf8") | ||
// look for next/(*) and replace with "next/(*).js" equivalent | ||
const newContent = content.replace(/next\/(\w+)/g, "next/$1.js") | ||
// write the new content to the file | ||
fs.writeFileSync(`dist/${file}`, newContent) | ||
}), | ||
) |
26800ee
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
chakra-ui-storybook – ./
chakra-ui-storybook.vercel.app
chakra-ui-storybook-git-main-chakra-ui.vercel.app
storybook.chakra-ui.com
chakra-ui-storybook-chakra-ui.vercel.app