Skip to content

Error: Cannot find module on ISR when using dynamic imports #209

Closed
@zomars

Description

@zomars

Describe the bug

Using Incremental Static Regeneration seems to be breaking when using dynamic imported components.

To Reproduce
Steps to reproduce the behavior:

  1. Make a page that uses getStaticProps and getStaticPaths
  2. Add a dynamic component using next/dynamic
  3. Enable revalidate: 1 in getStaticProps
  4. See error

Expected behavior

It is expected to show the pre-rendered paged, instead I get this error:

Here's the error output:
{
  "errorType": "Runtime.UnhandledPromiseRejection",
  "errorMessage": "Error: Cannot find module '../../chunks/886.4ea9d7ad9b7228e07a29.js'\nRequire stack:\n- /var/task/src/netlify/functions/next_pages_slug/nextPage/index.js\n- /var/task/src/netlify/functions/next_pages_slug/renderNextPage.js\n- /var/task/src/netlify/functions/next_pages_slug/next_pages_slug.js\n- /var/task/next_pages_slug.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js",
  "trace": [
    "Runtime.UnhandledPromiseRejection: Error: Cannot find module '../../chunks/886.4ea9d7ad9b7228e07a29.js'",
    "Require stack:",
    "- /var/task/src/netlify/functions/next_pages_slug/nextPage/index.js",
    "- /var/task/src/netlify/functions/next_pages_slug/renderNextPage.js",
    "- /var/task/src/netlify/functions/next_pages_slug/next_pages_slug.js",
    "- /var/task/next_pages_slug.js",
    "- /var/runtime/UserFunction.js",
    "- /var/runtime/index.js",
    "    at process.<anonymous> (/var/runtime/index.js:35:15)",
    "    at process.emit (events.js:314:20)",
    "    at processPromiseRejections (internal/process/promises.js:209:33)",
    "    at processTicksAndRejections (internal/process/task_queues.js:98:32)"
  ]
}

Versions

  • Next.js: latest
  • plugin (if installed at fixed version): @netlify/plugin-nextjs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions