Skip to content

Class constructor Link cannot be invoked without 'new' #16

Open
@Garrett-R

Description

@Garrett-R

I'm getting the same error as in #12 for dynamic pages. (that issue was closed by the poster without solution)

I've created a maximally simple example based off of create-next-app and then adding 2 simple commits -- the first creating a simple dynamic page, and the second using data-prefetch-link.

When I execute npm run build, I get this:

TypeError: Class constructor Link cannot be invoked without 'new'

> Build error occurred
Error: Export encountered errors on following paths:
	/
    at exportApp (/home/garrett/repro_prefetch_bug/node_modules/next/dist/export/index.js:22:1166)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
    at async build (/home/garrett/repro_prefetch_bug/node_modules/next/dist/build/index.js:36:218)

Similarly after the build, running npm run start and visiting http://localhost:3000/, I get:

~/repro_prefetch_bug $ npm run start

> repro_prefetch_bug@0.1.0 start /home/garrett/repro_prefetch_bug
> next start

ready - started server on http://localhost:3000
TypeError: Class constructor Link cannot be invoked without 'new'
    at new DataPrefetchLink (/home/garrett/repro_prefetch_bug/node_modules/data-prefetch-link/dist/link.js:54:79)
    at d (/home/garrett/repro_prefetch_bug/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:36:320)
    at $a (/home/garrett/repro_prefetch_bug/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:39:16)
    at a.b.render (/home/garrett/repro_prefetch_bug/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:476)
    at a.b.read (/home/garrett/repro_prefetch_bug/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:44:18)
    at renderToString (/home/garrett/repro_prefetch_bug/node_modules/react-dom/cjs/react-dom-server.node.production.min.js:54:364)
    at render (/home/garrett/repro_prefetch_bug/node_modules/next/dist/next-server/server/render.js:3:298)
    at Object.renderPage (/home/garrett/repro_prefetch_bug/node_modules/next/dist/next-server/server/render.js:46:1020)
    at Function.getInitialProps (/home/garrett/repro_prefetch_bug/.next/server/static/I4_UWuzN4JT1KYPsHdXK7/pages/_document.js:265:19)
    at loadGetInitialProps (/home/garrett/repro_prefetch_bug/node_modules/next/dist/next-server/lib/utils.js:5:101)

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