diff --git a/packages/next/next-server/lib/loadable.js b/packages/next/next-server/lib/loadable.js index 3b2381b319dfb..73514019d8321 100644 --- a/packages/next/next-server/lib/loadable.js +++ b/packages/next/next-server/lib/loadable.js @@ -94,7 +94,8 @@ function createLoadableComponent(loadFn, options) { if ( !initialized && typeof window !== 'undefined' && - typeof opts.webpack === 'function' + typeof opts.webpack === 'function' && + typeof require.resolveWeak === 'function' ) { const moduleIds = opts.webpack() READY_INITIALIZERS.push((ids) => { diff --git a/test/unit/fixtures/stub-components/hello.js b/test/unit/fixtures/stub-components/hello.js new file mode 100644 index 0000000000000..898cf5f1240fb --- /dev/null +++ b/test/unit/fixtures/stub-components/hello.js @@ -0,0 +1,5 @@ +import React from 'react' + +export default function Hello() { + return