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
75203eb8
Unverified
Commit
75203eb8
authored
May 02, 2019
by
JJ Kasper
Committed by
GitHub
May 02, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix missing injectCaller (#7223)
parent
13c55a19
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
1 deletion
+44
-1
next-babel-loader.ts
packages/next/build/webpack/loaders/next-babel-loader.ts
+2
-1
injectCaller.ts
...t/build/webpack/loaders/next-babel-loader/injectCaller.ts
+42
-0
No files found.
packages/next/build/webpack/loaders/next-babel-loader.ts
View file @
75203eb8
...
@@ -4,6 +4,7 @@ import { loader } from 'webpack'
...
@@ -4,6 +4,7 @@ import { loader } from 'webpack'
import
{
join
,
basename
}
from
'path'
import
{
join
,
basename
}
from
'path'
import
loaderUtils
from
'loader-utils'
import
loaderUtils
from
'loader-utils'
import
cache
from
'./next-babel-loader/cache'
import
cache
from
'./next-babel-loader/cache'
import
injectCaller
from
'./next-babel-loader/injectCaller'
import
transform
,
{
version
as
transformVersion
}
from
'./next-babel-loader/transform'
import
transform
,
{
version
as
transformVersion
}
from
'./next-babel-loader/transform'
// increment 'a' to invalidate cache
// increment 'a' to invalidate cache
...
@@ -57,7 +58,7 @@ const nextBabelLoader: loader.Loader = function (source, inputSourceMap) {
...
@@ -57,7 +58,7 @@ const nextBabelLoader: loader.Loader = function (source, inputSourceMap) {
delete
programmaticOptions
.
asyncToPromises
delete
programmaticOptions
.
asyncToPromises
delete
programmaticOptions
.
distDir
delete
programmaticOptions
.
distDir
const
config
:
any
=
babel
.
loadPartialConfig
(
programmaticOptions
);
const
config
:
any
=
babel
.
loadPartialConfig
(
injectCaller
(
programmaticOptions
)
);
if
(
config
)
{
if
(
config
)
{
let
options
=
config
.
options
;
let
options
=
config
.
options
;
...
...
packages/next/build/webpack/loaders/next-babel-loader/injectCaller.ts
0 → 100644
View file @
75203eb8
import
*
as
babel
from
"@babel/core"
export
default
function
injectCaller
(
opts
:
any
)
{
if
(
!
supportsCallerOption
())
return
opts
;
return
Object
.
assign
({},
opts
,
{
caller
:
Object
.
assign
(
{
name
:
"babel-loader"
,
// Webpack >= 2 supports ESM and dynamic import.
supportsStaticESM
:
true
,
supportsDynamicImport
:
true
,
},
opts
.
caller
,
),
});
};
// TODO: We can remove this eventually, I'm just adding it so that people have
// a little time to migrate to the newer RCs of @babel/core without getting
// hard-to-diagnose errors about unknown 'caller' options.
let
supportsCallerOptionFlag
:
any
=
undefined
;
function
supportsCallerOption
()
{
if
(
supportsCallerOptionFlag
===
undefined
)
{
try
{
// Rather than try to match the Babel version, we just see if it throws
// when passed a 'caller' flag, and use that to decide if it is supported.
babel
.
loadPartialConfig
({
// @ts-ignore
caller
:
undefined
,
babelrc
:
false
,
configFile
:
false
,
});
supportsCallerOptionFlag
=
true
;
}
catch
(
err
)
{
supportsCallerOptionFlag
=
false
;
}
}
return
supportsCallerOptionFlag
;
}
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