Unverified Commit 4619996d authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Resolve TypeScript Extension in Correct Order (#12014)

parent 4b3967fa
...@@ -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',
......
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 />
......
...@@ -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...')
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment