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
4619996d
Unverified
Commit
4619996d
authored
Apr 19, 2020
by
Joe Haddad
Committed by
GitHub
Apr 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Resolve TypeScript Extension in Correct Order (#12014)
parent
4b3967fa
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
5 deletions
+14
-5
webpack-config.ts
packages/next/build/webpack-config.ts
+2
-2
js-first.js
test/integration/typescript/extension-order/js-first.js
+1
-0
js-first.ts
test/integration/typescript/extension-order/js-first.ts
+1
-0
hello.tsx
test/integration/typescript/pages/hello.tsx
+5
-3
index.test.js
test/integration/typescript/test/index.test.js
+5
-0
No files found.
packages/next/build/webpack-config.ts
View file @
4619996d
...
@@ -247,17 +247,17 @@ export default async function getBaseWebpackConfig(
...
@@ -247,17 +247,17 @@ export default async function getBaseWebpackConfig(
// Disable .mjs for node_modules bundling
// Disable .mjs for node_modules bundling
extensions
:
isServer
extensions
:
isServer
?
[
?
[
...(
useTypeScript
?
[
'.tsx'
,
'.ts'
]
:
[]),
'.js'
,
'.js'
,
'.mjs'
,
'.mjs'
,
...(
useTypeScript
?
[
'.tsx'
,
'.ts'
]
:
[]),
'.jsx'
,
'.jsx'
,
'.json'
,
'.json'
,
'.wasm'
,
'.wasm'
,
]
]
:
[
:
[
...(
useTypeScript
?
[
'.tsx'
,
'.ts'
]
:
[]),
'.mjs'
,
'.mjs'
,
'.js'
,
'.js'
,
...(
useTypeScript
?
[
'.tsx'
,
'.ts'
]
:
[]),
'.jsx'
,
'.jsx'
,
'.json'
,
'.json'
,
'.wasm'
,
'.wasm'
,
...
...
test/integration/typescript/extension-order/js-first.js
0 → 100644
View file @
4619996d
export
const
value
=
'OK'
test/integration/typescript/extension-order/js-first.ts
0 → 100644
View file @
4619996d
export
const
value
=
'WRONG FILE'
test/integration/typescript/pages/hello.tsx
View file @
4619996d
import
React
from
'react'
import
{
useRouter
}
from
'next/router'
import
{
useRouter
}
from
'next/router'
import
React
from
'react'
import
{
hello
}
from
'../components/hello'
import
{
hello
}
from
'../components/hello'
import
{
World
}
from
'../components/world'
import
Router
from
'../components/router'
import
Link
from
'../components/link'
import
Link
from
'../components/link'
import
Router
from
'../components/router'
import
{
World
}
from
'../components/world'
import
{
value
as
resolveOrderValue
}
from
'../extension-order/js-first'
export
default
function
HelloPage
():
JSX
.
Element
{
export
default
function
HelloPage
():
JSX
.
Element
{
const
router
=
useRouter
()
const
router
=
useRouter
()
...
@@ -12,6 +13,7 @@ export default function HelloPage(): JSX.Element {
...
@@ -12,6 +13,7 @@ export default function HelloPage(): JSX.Element {
return
(
return
(
<
div
>
<
div
>
<
p
>
One trillion dollars:
{
1
_000_000_000_000
}
</
p
>
<
p
>
One trillion dollars:
{
1
_000_000_000_000
}
</
p
>
<
p
id=
"imported-value"
>
{
resolveOrderValue
}
</
p
>
{
hello
()
}
<
World
/>
{
hello
()
}
<
World
/>
<
Router
/>
<
Router
/>
<
Link
/>
<
Link
/>
...
...
test/integration/typescript/test/index.test.js
View file @
4619996d
...
@@ -46,6 +46,11 @@ describe('TypeScript Features', () => {
...
@@ -46,6 +46,11 @@ describe('TypeScript Features', () => {
expect
(
$
(
'body'
).
text
()).
toMatch
(
/1000000000000/
)
expect
(
$
(
'body'
).
text
()).
toMatch
(
/1000000000000/
)
})
})
it
(
'should resolve files in correct order'
,
async
()
=>
{
const
$
=
await
get
$
(
'/hello'
)
expect
(
$
(
'#imported-value'
).
text
()).
toBe
(
'OK'
)
})
it
(
'should report type checking to stdout'
,
async
()
=>
{
it
(
'should report type checking to stdout'
,
async
()
=>
{
expect
(
output
).
toContain
(
'waiting for typecheck results...'
)
expect
(
output
).
toContain
(
'waiting for typecheck results...'
)
})
})
...
...
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