Issue 1:
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

Issue 2:
I'm having a small issue with using a custom location for the pages directory. It appears as though the babel-loader is no longer able to parse the components referenced in each page.

Any thoughts? Or am I going to have to implement my own babel-loader in the next.config.js?

https://github.com/stephencorwin/nextjs-hello-world

├── /app
| ├── /components
| | ├── /Footer
| | | ├── Footer.js
| | | ├── index.js
| | | └── styles.js
| | ├── /Greeting
| | | ├── Greeting.js
| | | ├── index.js
| | | └── styles.js
| | └── /Header
| | ├── Header.js
| | ├── index.js
| | └── styles.js
| └── /templates
| └── /Home
| ├── Home.js
| ├── index.js
| └── styles.js
└── /server
├── index.js
├── /middleware
| └── index.js
└── /pages
├── index.js
└── _document.js

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

Expected Behavior

Components imported from the /apps/components/ folder should be parsed using the Next.js implementation of the babel-loader.

Current Behavior

error in ./app/components/Header/Header.js

Module parse failed: D:\stephencorwin\projects\nextjs-hello-world\node_modules\react-hot-loader\webpack.js!D:\stephencorwin\projects\nextjs-hello-world\app\components\Header\Header.js Unexpected token (1:34)

You may need an appropriate loader to handle this file type.
| export default ({ className }) => <div className={className}>Header</div>;

Steps to Reproduce (for bugs)

Clone Repository

npm -i

npm run dev

Context

Ideally, I would like to have the pages directory be segregated from the other components.

It currently works if I colocated the pages directory next to the templates and components that are also being loaded. View the Pull Request below for details.

https://github.com/stephencorwin/nextjs-hello-world/pull/1

├── /app
| ├── /components
| | ├── /Footer
| | | ├── Footer.js
| | | ├── index.js
| | | └── styles.js
| | ├── /Greeting
| | | ├── Greeting.js
| | | ├── index.js
| | | └── styles.js
| | └── /Header
| | ├── Header.js
| | ├── index.js
| | └── styles.js
| ├── /pages
| | ├── index.js
| | └── _document.js
| └── /templates
| └── /Home
| ├── Home.js
| ├── index.js
| └── styles.js
└── /server
├── index.js
└── /middleware
└── index.js

Your Environment

Tech
Version

next
4.2.3

node
8.7.0

OS
Windows 10