timlrx / pliny

Create content rich websites with ease - built on next.js, contentlayer and tailwindcss
MIT License
293 stars 42 forks source link

Cannot deploy to Edge servers. #139

Closed bskimball closed 1 year ago

bskimball commented 1 year ago

Tried both Vercel and Cloudflare pages. Below is the error received when trying to access a page using MDX.

EvalError: Code generation from strings disallowed for this context
    at (node_modules/pliny/mdx-components.js:9:13)
    at (node_modules/pliny/mdx-components.js:13:29)
    at (node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js:28:35)
    at (node_modules/next/dist/compiled/react/cjs/react.shared-subset.production.min.js:29:98)
    at (node_modules/pliny/mdx-components.js:13:9)
    at (node_modules/pliny/mdx-components.js:17:14)
    at (node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js:41:208)
    at (node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js:46:158)
    at (node_modules/next/dist/compiled/react-server-dom-webpack/cjs/react-server-dom-webpack-server.edge.production.min.js:37:180)
bskimball commented 1 year ago

For anyone else, this issue was caused by trying to use the edge runtime. Content Layer uses eval which is forbidden on the edge.

TheAlphamerc commented 5 months ago

Getting same issue on Vercel. Is there any solution of this

bskimball commented 5 months ago

@TheAlphamerc I just run the site as SSG

vioao commented 4 months ago

@bskimball How do you solve the problem?