Skip to content

Can't use dynamic expressions in imports #2533

@Roger

Description

@Roger
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Imports like, import(./widgets/${name}/index.js) work

Current Behavior

Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
    at __webpack_require__ (http://localhost:3242/_next/1499784830986/manifest.js:698:30)
    at fn (http://localhost:3242/_next/1499784830986/manifest.js:117:20)
    at SameLoopPromise.ssr [as cb] (http://localhost:3242/_next/1499784830986/page/metaspace:296:38)
    at SameLoopPromise.runIfNeeded (http://localhost:3242/_next/1499784830986/commons.js:53634:12)
    at SameLoopPromise.then (http://localhost:3242/_next/1499784830986/commons.js:53564:12)
    at DynamicComponent.loadComponent (http://localhost:3242/_next/1499784830986/commons.js:53416:17)
    at DynamicComponent.load (http://localhost:3242/_next/1499784830986/commons.js:53406:16)
    at DynamicComponent.componentDidMount (http://localhost:3242/_next/1499784830986/commons.js:53484:16)
    at http://localhost:3242/_next/1499784830986/commons.js:32667:25
    at measureLifeCyclePerf (http://localhost:3242/_next/1499784830986/commons.js:32478:12)

Steps to Reproduce (for bugs)

Use dynamic imports like this:

const loadModule = name => dynamic(import('./modules/' + name + '/index.js'))
...
const Component = loadModule('name');
() => <Component />

Context

Your Environment

Tech Version
next next@3.0.1-beta.13
node v8.1.2
OS linux
browser chrome

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