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
e5002234
Unverified
Commit
e5002234
authored
Nov 30, 2018
by
Tim Neutkens
Committed by
GitHub
Nov 30, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Transpile imports if module has module.exports (#5780)
Fixes #5778 Fixes #3650
parent
633dd87b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
1 deletion
+33
-1
next-babel-loader.js
packages/next/build/webpack/loaders/next-babel-loader.js
+6
-1
async-function.js
test/integration/basic/lib/async-function.js
+3
-0
read-only-object-error.js
test/integration/basic/pages/read-only-object-error.js
+12
-0
client-navigation.js
test/integration/basic/test/client-navigation.js
+12
-0
No files found.
packages/next/build/webpack/loaders/next-babel-loader.js
View file @
e5002234
...
@@ -21,7 +21,7 @@ module.exports = babelLoader.custom(babel => {
...
@@ -21,7 +21,7 @@ module.exports = babelLoader.custom(babel => {
return
{
loader
,
custom
}
return
{
loader
,
custom
}
},
},
config
(
cfg
,
{
customOptions
:
{
isServer
,
dev
}})
{
config
(
cfg
,
{
source
,
customOptions
:
{
isServer
,
dev
}})
{
const
options
=
Object
.
assign
({},
cfg
.
options
)
const
options
=
Object
.
assign
({},
cfg
.
options
)
if
(
cfg
.
hasFilesystemConfig
())
{
if
(
cfg
.
hasFilesystemConfig
())
{
for
(
const
file
of
[
cfg
.
babelrc
,
cfg
.
config
])
{
for
(
const
file
of
[
cfg
.
babelrc
,
cfg
.
config
])
{
...
@@ -37,6 +37,11 @@ module.exports = babelLoader.custom(babel => {
...
@@ -37,6 +37,11 @@ module.exports = babelLoader.custom(babel => {
options
.
presets
=
[...
options
.
presets
,
presetItem
]
options
.
presets
=
[...
options
.
presets
,
presetItem
]
}
}
if
(
source
.
match
(
/module
\.
exports/
))
{
options
.
plugins
=
options
.
plugins
||
[]
options
.
plugins
.
push
(
commonJsItem
)
}
options
.
overrides
=
[
options
.
overrides
=
[
...(
options
.
overrides
||
[]),
...(
options
.
overrides
||
[]),
{
{
...
...
test/integration/basic/lib/async-function.js
0 → 100644
View file @
e5002234
module
.
exports
=
async
function
()
{
return
'test'
}
test/integration/basic/pages/read-only-object-error.js
0 → 100644
View file @
e5002234
import
test
from
'../lib/async-function'
function
ReadOnlyObjectError
()
{
return
'this is just a placeholder component'
}
ReadOnlyObjectError
.
getInitialProps
=
async
()
=>
{
const
result
=
await
test
()
return
{
result
}
}
export
default
ReadOnlyObjectError
test/integration/basic/test/client-navigation.js
View file @
e5002234
...
@@ -732,5 +732,17 @@ export default (context) => {
...
@@ -732,5 +732,17 @@ export default (context) => {
}
}
})
})
})
})
it
(
'should not error on module.exports + polyfills'
,
async
()
=>
{
let
browser
try
{
browser
=
await
webdriver
(
context
.
appPort
,
'/read-only-object-error'
)
expect
(
await
browser
.
elementByCss
(
'body'
).
text
()).
toBe
(
'this is just a placeholder component'
)
}
finally
{
if
(
browser
)
{
browser
.
close
()
}
}
})
})
})
}
}
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