Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/461.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/vim/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript NextJS ReferenceError:未定义元素_Javascript_Reactjs_Next.js_Rollupjs - Fatal编程技术网

Javascript NextJS ReferenceError:未定义元素

Javascript NextJS ReferenceError:未定义元素,javascript,reactjs,next.js,rollupjs,Javascript,Reactjs,Next.js,Rollupjs,在我使用rollup.js捆绑了我的ReactJS组件之后,我尝试使用nextjs。 但nextjs会出现以下错误: ReferenceError: Element is not defined 这是我的rollup.config.js const extensions = [".js", ".jsx", ".ts", ".tsx"]; export default { input: "./src/

在我使用rollup.js捆绑了我的ReactJS组件之后,我尝试使用nextjs。 但nextjs会出现以下错误:

ReferenceError: Element is not defined
这是我的
rollup.config.js

const extensions = [".js", ".jsx", ".ts", ".tsx"];

export default {
  input: "./src/index.js",
  output: [
    {
      file: pkg.main,
      format: "cjs",
    },
    {
      file: pkg.module,
      format: "esm",
    },
  ],
  plugins: [
    external(),
    postcss({
      plugins: [
        simplevars(),
        cssvariables(),
        nested(),
        cssnext({ warnForDuplicates: false}),
        cssnano(),
      ],
      extensions: [".css"],
    }),
    babel({
      exclude: "node_modules/**",
      extensions,
    }),
    // Allows node_modules resolution
    resolve({
      mainFields: ["module", "main", "jsnext:main", "browser"],
      extensions,
    }),
    commonjs(),
    image(),
    visualizer(),
  ],
};
在reactjs应用程序中通常没有使用问题。但nextjs就是这样。我想可能是关于ssr的。但我不确定

如何修复此错误? 是否需要更改
rollap.config.js
以消除此错误

谢谢