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

Broken Webpack's "resolve.alias" (Next 11.1.3-canary.41) #29553

Closed
thecynicalpaul opened this issue Oct 1, 2021 · 1 comment · Fixed by #29611
Closed

Broken Webpack's "resolve.alias" (Next 11.1.3-canary.41) #29553

thecynicalpaul opened this issue Oct 1, 2021 · 1 comment · Fixed by #29611
Labels
bug Issue was opened via the bug report template.

Comments

@thecynicalpaul
Copy link

What version of Next.js are you using?

11.1.3-canary.41

What version of Node.js are you using?

14.18.0

What browser are you using?

Chrome

What operating system are you using?

Windows 10

How are you deploying your application?

next start

Describe the Bug

Hi there.

It seems like webpack's resolve.alias in webpack config is not behaving correctly in the last canary releases. When trying to create a conditional resolution, for example:

webpack: (config, {isServer}) => { 
  config.resolve = {
    ...config.resolve,
    alias: {
      ...config.resolve.alias,
      parse: isServer ? "parse/node" : "parse"
    }
  };
  return config;
};

It still keeps the "parse" imports, resulting in errors during SSR page compilation related to missing browser APIs. (localStorage in this case).

This is only the case in canary, and works fine in the lastest.

Expected Behavior

Resolve all imports during SSR stage to the specified module.

To Reproduce

  1. Clone https://github.com/thecynicalpaul/broken-next-alias
  2. npm i
  3. npm run build
@thecynicalpaul thecynicalpaul added the bug Issue was opened via the bug report template. label Oct 1, 2021
sokra added a commit that referenced this issue Oct 4, 2021
@sokra sokra mentioned this issue Oct 4, 2021
3 tasks
@kodiakhq kodiakhq bot closed this as completed in #29611 Oct 4, 2021
kodiakhq bot pushed a commit that referenced this issue Oct 4, 2021
fixes #29553

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
@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 27, 2022
natew pushed a commit to natew/next.js that referenced this issue Feb 16, 2022
fixes vercel#29553

## Bug

- [x] Related issues linked using `fixes #number`
- [x] Integration tests added
- [ ] Errors have helpful link attached, see `contributing.md`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue was opened via the bug report template.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants