-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move webpack specific logic into a separate file (#53114)
### What? move webpack specific code out of the `client/index.ts` file ### Why? sharing with turbopack. Avoiding extra shims to fake webpack.
- Loading branch information
Showing
9 changed files
with
63 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
packages/next-swc/crates/next-core/js/src/build/client/shims.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import './webpack' | ||
import { initialize, hydrate, version, router, emitter } from './' | ||
|
||
declare global { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
declare let __webpack_public_path__: string | ||
|
||
const addChunkSuffix = | ||
(getOriginalChunk: (chunkId: any) => string) => (chunkId: any) => { | ||
return ( | ||
getOriginalChunk(chunkId) + | ||
`${ | ||
process.env.NEXT_DEPLOYMENT_ID | ||
? `?dpl=${process.env.NEXT_DEPLOYMENT_ID}` | ||
: '' | ||
}` | ||
) | ||
} | ||
|
||
// ensure dynamic imports have deployment id added if enabled | ||
const getChunkScriptFilename = __webpack_require__.u | ||
// eslint-disable-next-line no-undef | ||
__webpack_require__.u = addChunkSuffix(getChunkScriptFilename) | ||
|
||
// eslint-disable-next-line no-undef | ||
const getChunkCssFilename = __webpack_require__.k | ||
// eslint-disable-next-line no-undef | ||
__webpack_require__.k = addChunkSuffix(getChunkCssFilename) | ||
|
||
// eslint-disable-next-line no-undef | ||
const getMiniCssFilename = __webpack_require__.miniCssF | ||
// eslint-disable-next-line no-undef | ||
__webpack_require__.miniCssF = addChunkSuffix(getMiniCssFilename) | ||
|
||
// Ignore the module ID transform in client. | ||
// @ts-ignore | ||
;(self as any).__next_require__ = __webpack_require__ | ||
;(self as any).__next_set_public_path__ = (path: string) => { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
__webpack_public_path__ = path | ||
} |