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
f81e5f4c
Commit
f81e5f4c
authored
Mar 30, 2019
by
Luis Fernando Alvarez D
Committed by
Tim Neutkens
Mar 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added babel-plugin-dynamic-import-node (#6811)
Replaces `import()` with `require` only for the testing environment.
parent
26a4eb82
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
1 deletion
+13
-1
preset.ts
packages/next/build/babel/preset.ts
+2
-0
package.json
packages/next/package.json
+1
-0
next-test-utils.js
test/lib/next-test-utils.js
+3
-1
yarn.lock
yarn.lock
+7
-0
No files found.
packages/next/build/babel/preset.ts
View file @
f81e5f4c
...
...
@@ -73,6 +73,8 @@ module.exports = (api: any, options: NextBabelPresetOptions = {}): BabelPreset =
plugins
:
[
require
(
'babel-plugin-react-require'
),
require
(
'@babel/plugin-syntax-dynamic-import'
),
// Transform dynamic import to require
isTest
&&
require
(
'babel-plugin-dynamic-import-node'
),
require
(
'./plugins/react-loadable-plugin'
),
[
require
(
'@babel/plugin-proposal-class-properties'
),
options
[
'class-properties'
]
||
{}],
require
(
'@babel/plugin-proposal-object-rest-spread'
),
...
...
packages/next/package.json
View file @
f81e5f4c
...
...
@@ -54,6 +54,7 @@
"autodll-webpack-plugin"
:
"0.4.2"
,
"babel-core"
:
"7.0.0-bridge.0"
,
"babel-loader"
:
"8.0.2"
,
"babel-plugin-dynamic-import-node"
:
"2.2.0"
,
"babel-plugin-react-require"
:
"3.0.0"
,
"babel-plugin-transform-react-remove-prop-types"
:
"0.4.15"
,
"chalk"
:
"2.4.2"
,
...
...
test/lib/next-test-utils.js
View file @
f81e5f4c
...
...
@@ -116,8 +116,10 @@ export function runNextCommand (argv, options = {}) {
export
function
runNextCommandDev
(
argv
,
stdOut
)
{
const
cwd
=
path
.
dirname
(
require
.
resolve
(
'next/package'
))
const
env
=
{
...
process
.
env
,
NODE_ENV
:
undefined
}
return
new
Promise
((
resolve
,
reject
)
=>
{
const
instance
=
spawn
(
'node'
,
[
'dist/bin/next'
,
...
argv
],
{
cwd
})
const
instance
=
spawn
(
'node'
,
[
'dist/bin/next'
,
...
argv
],
{
cwd
,
env
})
function
handleStdout
(
data
)
{
const
message
=
data
.
toString
()
...
...
yarn.lock
View file @
f81e5f4c
...
...
@@ -2532,6 +2532,13 @@ babel-messages@^6.23.0:
dependencies:
babel-runtime "^6.22.0"
babel-plugin-dynamic-import-node@2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.2.0.tgz#c0adfb07d95f4a4495e9aaac6ec386c4d7c2524e"
integrity sha512-fP899ELUnTaBcIzmrW7nniyqqdYWrWuJUyPWHxFa/c7r7hS6KC8FscNfLlBNIoPSc55kYMGEEKjPjJGCLbE1qA==
dependencies:
object.assign "^4.1.0"
babel-plugin-istanbul@^4.1.6:
version "4.1.6"
resolved "https://registry.yarnpkg.com/babel-plugin-istanbul/-/babel-plugin-istanbul-4.1.6.tgz#36c59b2192efce81c5b378321b74175add1c9a45"
...
...
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