Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Module not found: Can't resolve 'private-next-pages/about.js' #8748

Closed
kaluabentes opened this issue Sep 16, 2019 · 4 comments
Closed

Module not found: Can't resolve 'private-next-pages/about.js' #8748

kaluabentes opened this issue Sep 16, 2019 · 4 comments

Comments

@kaluabentes
Copy link

Bug report

When I try to build I get the following error:

Module not found: Can't resolve 'private-next-pages/about.js'

Then build fails.

To Reproduce

  1. Create a page named about.js with a component exported.
  2. Try to build.

Expected behavior

My application built

System information

  • MacOS
  • Chrome
  • Next.js v9
@kaluabentes
Copy link
Author

I just solved! The problem was with my next.config.js, I overwritten config.resolve.alias in the wrong way. The correct way is:

config.resolve.alias = {
  ...config.resolve.alias,
  ...myWebpackConfig.resolve.alias,
}

Just ;)

@hema1592
Copy link

hema1592 commented Dec 1, 2020

@k4lux , I'm also facing the same issue and I'm adding the components/pages path as well. The solution which you wrote resolve the module not found issue. But, we are getting 'private-next-pages/_apps.js not found' .Could you please help on resolving this?

webpack(config) {
config.resolve.alias = {
...config.resolve.alias,
Component: path.resolve(__dirname, './components'),
Config: path.resolve(__dirname, './config'),
Page: path.resolve(__dirname, './pages'),
Model: path.resolve(__dirname, './adapters/model'),
Static: path.resolve(__dirname, './static')
}
}

@timneutkens
Copy link
Member

You can use https://nextjs.org/docs/advanced-features/module-path-aliases to do path aliases, no need to change the webpack config.

@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants