Skip to content

Dynamic imports do not load in production builds when a custom distDir is set #2371

@sbking

Description

@sbking

Example repo: https://github.com/sbking/nextjs-dynamic-import-distdir

This example shows that dynamic import webpack chunks return 404 errors in production builds if a custom distDir is set in next.config.js. This is simply the with-dynamic-imports example with the following next config:

const config = {
  distDir: 'build',
}

module.exports = config

The dynamic imports work perfectly in development mode, but give 404 errors in a production build.

Metadata

Metadata

Assignees

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