When trying to compile (for dev or prod), I get the following error:
./node_modules/next/dist/build/webpack/loaders/next-client-pages-loader.js?page=%2F_app&absolutePagePath=private-next-pages%2F_app.tsx
Module not found: Can't resolve 'private-next-pages/_app.tsx' in './my-project'
There are no other logs to go along with this. Not really sure what other info would be helpful
Hi, we really need a reproduction help you with this (the issue template mentions this).
Thanks!
I don't have a way to reproduce this, but insight into how to debug this would be appreciated. I have no idea what is happening here, so i have no way to create something to reproduce it.
Only info I can give, is that i have a custom server, with everything in typescript.
There is no stack trace, so this error is very unhelpful for me.
Sounds like you're customizing the webpack config function the wrong way 馃 You're probably adding config.resolve.alias or similar and overriding what Next.js provides.
I removed any custom webpack config i was doing. Getting further in the compile process, getting this now:
./node_modules/next/dist/client/next-dev.js 34:6
Module parse failed: Unexpected token (34:6)
You may need an appropriate loader to handle this file type.
|
|
> import('./noop');
| var _window = window,
| assetPrefix = _window.__NEXT_DATA__.assetPrefix;
Using withTypescript(withSourceMaps(withImages(withCss(withSass(
Appears to be solved with: https://github.com/zeit/next.js/issues/6240
@timneutkens I'm getting this same issue, but I am using the config.resolve.alias. Is there a way to continue to use that? I was doing this is in Next 7.0.2 and it worked fine... but now I'm getting the error described in @aequasi 's original post
// next.config.js
const webpack = require('webpack')
const path = require('path')
const withSass = require('@zeit/next-sass')
const withImages = require('next-images')
module.exports = withImages(
withSass({
distDir: 'build',
webpack(config) {
// alias the ./src folder to ~
config.resolve.alias = {
'~': path.resolve(__dirname, './src')
}
return config
}
})
)
EDIT:
Found the solution here: https://github.com/zeit/next.js/issues/6051#issuecomment-462934252
Thanks!
In my case, the issue was that I was completely overriding the config.resolve.
Here's my solution
module.exports = withTypescript(
withCSS({
webpack(config, options) {
// Further custom configuration here
config.resolve = {
// custom stuff
...config.resolve // spread ehre
};
return config;
}
})
);
Most helpful comment
In my case, the issue was that I was completely overriding the
config.resolve.Here's my solution