Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
cad2a756
Unverified
Commit
cad2a756
authored
Apr 07, 2020
by
JJ Kasper
Committed by
GitHub
Apr 07, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure to handle "next" import gracefully (#11733)
* Make sure to handle "next" import gracefully * Update test file
parent
44b7b3c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
webpack-config.ts
packages/next/build/webpack-config.ts
+8
-1
next-import.js
test/integration/production/pages/next-import.js
+14
-0
No files found.
packages/next/build/webpack-config.ts
View file @
cad2a756
...
...
@@ -473,10 +473,17 @@ export default async function getBaseWebpackConfig(
)
let
webpackConfig
:
webpack
.
Configuration
=
{
externals
:
!
isServer
?
undefined
?
// make sure importing "next" is handled gracefully for client
// bundles in case a user imported types and it wasn't removed
// TODO: should we warn/error for this instead?
[
'next'
]
:
!
isServerless
?
[
(
context
,
request
,
callback
)
=>
{
if
(
request
===
'next'
)
{
return
callback
(
undefined
,
`commonjs
${
request
}
`
)
}
const
notExternalModules
=
[
'next/app'
,
'next/document'
,
...
...
test/integration/production/pages/next-import.js
0 → 100644
View file @
cad2a756
import
Link
from
'next/link'
// Leave below import, testing that importing "next"
// doesn't stall the build
// eslint-disable-next-line no-unused-vars
import
next
from
'next'
export
default
()
=>
(
<
div
>
<
Link
href
=
"/about"
>
<
a
>
About
Page
<
/a
>
<
/Link
>
<
p
className
=
"index-page"
>
Hello
World
<
/p
>
<
/div
>
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment