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

import webpack not webpack5 #31421

Closed
wants to merge 1 commit into from
Closed

import webpack not webpack5 #31421

wants to merge 1 commit into from

Conversation

imranbarbhuiya
Copy link
Contributor

@imranbarbhuiya imranbarbhuiya commented Nov 15, 2021

next/dist/compiled/webpack/webpack exports webpack5 as webpack so we need to import webpack and not webpack5 inside https://github.com/vercel/next.js/blob/canary/packages/next/server/config-shared.ts#L2

next/dist/compiled/webpack/webpack

exports.init = function () {
  if (process.env.NEXT_PRIVATE_LOCAL_WEBPACK5) {
    Object.assign(exports, {
      webpack: require('webpack5'),
    })
  } 
}

https://github.com/vercel/next.js/blob/canary/packages/next/server/config-shared.ts#L2

import type { webpack5 } from 'next/dist/compiled/webpack/webpack'

Bug

  • Related issues linked using fixes #number
  • Integration tests added
  • Errors have helpful link attached, see contributing.md

Feature

  • Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
  • Related issues linked using fixes #number
  • Integration tests added
  • Documentation added
  • Telemetry added. In case of a feature if it's used or not.
  • Errors have helpful link attached, see contributing.md

Documentation / Examples

  • Make sure the linting passes by running yarn lint

fixes #31419

next/dist/compiled/webpack/webpack exports webpack5 as webpack so we need to import webpack and not webpack5 inside https://github.com/vercel/next.js/blob/canary/packages/next/server/config-shared.ts#L2


next/dist/compiled/webpack/webpack
```js
exports.init = function () {
  if (process.env.NEXT_PRIVATE_LOCAL_WEBPACK5) {
    Object.assign(exports, {
      webpack: require('webpack5'),
    })
  } 
}
```

https://github.com/vercel/next.js/blob/canary/packages/next/server/config-shared.ts#L2

```js
import type { webpack5 } from 'next/dist/compiled/webpack/webpack'
```
@timneutkens
Copy link
Member

Hey! Thanks for your PR! This issue was already fixed on next@canary and the current type imports are correct: #31206

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