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(
// Disable .mjs for node_modules bundling
extensions: isServer
? [
...(useTypeScript ? ['.tsx', '.ts'] : []),
'.js',
'.mjs',
...(useTypeScript ? ['.tsx', '.ts'] : []),
'.jsx',
'.json',
'.wasm',
]
: [
...(useTypeScript ? ['.tsx', '.ts'] : []),
'.mjs',
'.js',
...(useTypeScript ? ['.tsx', '.ts'] : []),
'.jsx',
'.json',
'.wasm',
......
import React from 'react'
import { useRouter } from 'next/router'
import React from 'react'
import { hello } from '../components/hello'
import { World } from '../components/world'
import Router from '../components/router'
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 {
const router = useRouter()
......@@ -12,6 +13,7 @@ export default function HelloPage(): JSX.Element {
return (
<div>
<p>One trillion dollars: {1_000_000_000_000}</p>
<p id="imported-value">{resolveOrderValue}</p>
{hello()} <World />
<Router />
<Link />
......
......@@ -46,6 +46,11 @@ describe('TypeScript Features', () => {
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 () => {
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