build the package with Plate Editor #1565
-
QuestionWhy can PlateUI package work well even in NextJS environment (server-side client-side both)? DetailsWhat I tried to do is build a wrapped editor library added some custom plugins. The problem is the output is not valid in certain environment. I packaged with const resolveOptions = {
extensions,
mainFields: ["module", "main"],
preferBuiltins: false,
browser: true,
};
const plugins = [
peerDepsExternal(),
commonjs(),
maintainedNodePolyfills(),
nodeResolve(resolveOptions),
typescript({
// typescript peerDependency
typescript: require("typescript"),
}),
// used by plateUI's Juice.
json(),
]; and the output works well in CRA, but not in NextJS with following error:
I guess such code injected because of node builtins API polyfills. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I'd use |
Beta Was this translation helpful? Give feedback.
I'd use
plate-headless
server-side, and bothplate-headless
andplate-ui
client-side