Skip to content

XMLHttpRequest is not defined #2

@oespn

Description

@oespn

I noted this issue when I installed the pivot table into my existing NextJS project.
I thought it was due to node_module compatibility. Now I've pulled your example and I experience the same issue:

1/ Slow load time. Followed by
2/ Error in the terminal window:

 event compiled client and server successfully in 17.5s (1201 modules)
- error node_modules/@syncfusion/ej2-pivotview/dist/ej2-pivotview.umd.min.js (10:572035) @ n.s [as constructor]
- error ReferenceError: XMLHttpRequest is not defined

The example still functions in dev mode. However the load time is an issue for development.

Secondly, when I build for production we experience the following error (log):

- info Creating an optimized production build  
- info Compiled successfully
- info Linting and checking validity of types  
- info Collecting page data  
[=   ] - info Generating static pages (3/4)ReferenceError: XMLHttpRequest is not defined
    at n.s [as constructor] (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/.next/server/chunks/195.js:287:571321)
    at new n (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/.next/server/chunks/195.js:341:521)
    at Ue (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:113:138)
    at Z (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91)
    at Ve (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:123:155)
    at Xe (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:122:289)
    at Z (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:350)
    at Ue (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:115:194)
    at Z (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91)
    at Ue (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:114:9)

Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error
ReferenceError: XMLHttpRequest is not defined
    at n.s [as constructor] (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/.next/server/chunks/195.js:287:571321)
    at new n (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/.next/server/chunks/195.js:341:521)
    at Ue (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:113:138)
    at Z (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91)
    at Ve (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:123:155)
    at Xe (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:122:289)
    at Z (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:350)
    at Ue (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:115:194)
    at Z (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:120:91)
    at Ue (/Users/currentuser/Downloads/syncfusion-react-pivotview-component-in-nextjs-master/node_modules/next/dist/compiled/react-dom/cjs/react-dom-server.edge.production.min.js:114:9)
- info Generating static pages (4/4)

> Export encountered errors on following paths:
        /page: /

 *  The terminal process "/bin/zsh '-l', '-c', 'npm run build'" terminated with exit code: 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions