View the deployed project: Demo
Clone the project:
git clone [email protected]:contentlayerdev/next-contentlayer-example.git
Install dependencies:
yarn
Run dev server:
yarn dev
Home Page: https://next-contentlayer-example.vercel.app/
View the deployed project: Demo
Clone the project:
git clone [email protected]:contentlayerdev/next-contentlayer-example.git
Install dependencies:
yarn
Run dev server:
yarn dev
Here is the repo:
https://github.com/yongyi520/contentlayer-example
I have cloned this repo and simply added
export const runtime = 'edge' // 'nodejs' (default) | 'edge'
on all pages
When I tried to deploy it to vercel, I got this issue:
EvalError: Code generation from strings disallowed for this context
Everything works fine on nodejs serverless, but when it's on edge it throws error somehow
Is there a workaround for this?
I converted this to JavaScript when adding the code for the getting started tutorial. As this becomes a richer example, let's use TypeScript.
We're currently showing use with Gitpod, but should switch to Stackblitz, as that's what we're using elsewhere. See here.
I won't fork for such a small change.
Your tailwind.config.js
is pointing to the pages
folder, but you are implementing next's experimental app
folder so no tailwind styling is being generated.
(...)
content: [
"./pages/**/*.{js,ts,jsx,tsx}",
(...)
Should be
(...)
content: [
"./app/**/*.{js,ts,jsx,tsx}",
(...)
When running the 'pnpm dev' command in the cloned repository, the following error occurs:
- error file:///C:/Users/baydis/Desktop/code/next-contentlayer-example/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+core@1._vak64uwhuw23bp45xj3whrz3hy/node_modules/@effect-ts/otel/_mjs/Processor/Simple/index.mjs:7
import { ConsoleSpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
^^^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'ConsoleSpanExporter' not found. The requested module '@opentelemetry/sdk-trace-base' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@opentelemetry/sdk-trace-base';
const { ConsoleSpanExporter, SimpleSpanProcessor } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
file:///C:/Users/baydis/Desktop/code/next-contentlayer-example/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+core@1._vak64uwhuw23bp45xj3whrz3hy/node_modules/@effect-ts/otel/_mjs/Processor/Simple/index.mjs:7
import { ConsoleSpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
^^^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'ConsoleSpanExporter' not found. The requested module '@opentelemetry/sdk-trace-base' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from '@opentelemetry/sdk-trace-base';
const { ConsoleSpanExporter, SimpleSpanProcessor } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
This error is related to the module '@opentelemetry/sdk-trace-base' and its named exports 'ConsoleSpanExporter' and 'SimpleSpanProcessor'. The error suggests that the requested module is a CommonJS module, which may not support importing named exports. Instead, it recommends importing via the default export.
Steps to Reproduce:
git clone https://github.com/contentlayerdev/next-contentlayer-example.git
cd next-contentlayer-example
pnpm i
pnpm dev
Expected Behavior:
The 'pnpm dev' command should run successfully without any syntax errors.
Actual Behavior:
The 'pnpm dev' command throws a SyntaxError related to the module '@opentelemetry/sdk-trace-base' and its named exports 'ConsoleSpanExporter' and 'SimpleSpanProcessor'. The error suggests importing via the default export instead.
Additional Information:
Hey it would be cool if we could get an MDX + image example here
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.