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
fad4ec39
Commit
fad4ec39
authored
Jul 15, 2019
by
JJ Kasper
Committed by
Tim Neutkens
Jul 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't externalize ssr-prepass if added by user (#7966)
parent
8c5e85d4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
1 deletion
+49
-1
webpack-config.ts
packages/next/build/webpack-config.ts
+13
-1
next.config.js
test/integration/ssr-prepass/next.config.js
+3
-0
index.js
test/integration/ssr-prepass/pages/index.js
+3
-0
index.test.js
test/integration/ssr-prepass/test/index.test.js
+30
-0
No files found.
packages/next/build/webpack-config.ts
View file @
fad4ec39
...
@@ -242,7 +242,19 @@ export default async function getBaseWebpackConfig(
...
@@ -242,7 +242,19 @@ export default async function getBaseWebpackConfig(
// When the serverless target is used all node_modules will be compiled into the output bundles
// When the serverless target is used all node_modules will be compiled into the output bundles
// So that the serverless bundles have 0 runtime dependencies
// So that the serverless bundles have 0 runtime dependencies
'amp-toolbox-optimizer'
,
// except this one
'amp-toolbox-optimizer'
,
// except this one
...(
config
.
experimental
.
ampBindInitData
?
[]
:
[
'react-ssr-prepass'
]),
(
context
,
request
,
callback
)
=>
{
if
(
request
===
'react-ssr-prepass'
&&
!
config
.
experimental
.
ampBindInitData
)
{
// if it's the Next.js' require mark it as external
// since it's not used
if
(
context
.
includes
(
'next-server/dist/server'
))
{
return
callback
(
undefined
,
`commonjs
${
request
}
`
)
}
}
return
callback
()
},
],
],
optimization
:
Object
.
assign
(
optimization
:
Object
.
assign
(
{
{
...
...
test/integration/ssr-prepass/next.config.js
0 → 100644
View file @
fad4ec39
module
.
exports
=
{
target
:
'serverless'
}
test/integration/ssr-prepass/pages/index.js
0 → 100644
View file @
fad4ec39
import
ssrPrepass
from
'react-ssr-prepass'
export
default
()
=>
<
p
>
hello
{
ssrPrepass
&&
'world'
}
<
/p
>
test/integration/ssr-prepass/test/index.test.js
0 → 100644
View file @
fad4ec39
/* eslint-env jest */
/* global jasmine */
import
{
join
}
from
'path'
import
{
killApp
,
findPort
,
nextStart
,
nextBuild
,
renderViaHTTP
}
from
'next-test-utils'
jasmine
.
DEFAULT_TIMEOUT_INTERVAL
=
1000
*
30
const
appDir
=
join
(
__dirname
,
'../'
)
let
appPort
let
app
describe
(
'SSR Prepass'
,
()
=>
{
beforeAll
(
async
()
=>
{
await
nextBuild
(
appDir
)
appPort
=
await
findPort
()
app
=
await
nextStart
(
appDir
,
appPort
)
})
afterAll
(()
=>
killApp
(
app
))
it
(
'should not externalize when used outside Next.js'
,
async
()
=>
{
const
html
=
await
renderViaHTTP
(
appPort
,
'/'
)
expect
(
html
).
toMatch
(
/hello.*
?
world/
)
})
})
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