forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for baseUrl option in tsconfig and jsconfig (vercel#11203)
* Add support for baseUrl option in tsconfig and jsconfig * Move jsconfigPath * Remove filter
- Loading branch information
1 parent
f0c6df4
commit 38e42cd
Showing
11 changed files
with
148 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react' | ||
|
||
export function World() { | ||
return <>World</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": "." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
onDemandEntries: { | ||
// Make sure entries are not getting disposed. | ||
maxInactiveAge: 1000 * 60 * 60, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react' | ||
import { World } from 'components/world' | ||
export default function HelloPage() { | ||
return ( | ||
<div> | ||
<World /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* eslint-env jest */ | ||
/* global jasmine */ | ||
import { join } from 'path' | ||
import cheerio from 'cheerio' | ||
import { renderViaHTTP, findPort, launchApp, killApp } from 'next-test-utils' | ||
|
||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2 | ||
|
||
const appDir = join(__dirname, '..') | ||
let appPort | ||
let app | ||
|
||
async function get$(path, query) { | ||
const html = await renderViaHTTP(appPort, path, query) | ||
return cheerio.load(html) | ||
} | ||
|
||
describe('TypeScript Features', () => { | ||
describe('default behavior', () => { | ||
beforeAll(async () => { | ||
appPort = await findPort() | ||
app = await launchApp(appDir, appPort, {}) | ||
}) | ||
afterAll(() => killApp(app)) | ||
|
||
it('should render the page', async () => { | ||
const $ = await get$('/hello') | ||
expect($('body').text()).toMatch(/World/) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react' | ||
|
||
export function World(): JSX.Element { | ||
return <>World</> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
onDemandEntries: { | ||
// Make sure entries are not getting disposed. | ||
maxInactiveAge: 1000 * 60 * 60, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import React from 'react' | ||
import { World } from 'components/world' | ||
export default function HelloPage(): JSX.Element { | ||
return ( | ||
<div> | ||
<World /> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* eslint-env jest */ | ||
/* global jasmine */ | ||
import { join } from 'path' | ||
import cheerio from 'cheerio' | ||
import { renderViaHTTP, findPort, launchApp, killApp } from 'next-test-utils' | ||
|
||
jasmine.DEFAULT_TIMEOUT_INTERVAL = 1000 * 60 * 2 | ||
|
||
const appDir = join(__dirname, '..') | ||
let appPort | ||
let app | ||
|
||
async function get$(path, query) { | ||
const html = await renderViaHTTP(appPort, path, query) | ||
return cheerio.load(html) | ||
} | ||
|
||
describe('TypeScript Features', () => { | ||
describe('default behavior', () => { | ||
beforeAll(async () => { | ||
appPort = await findPort() | ||
app = await launchApp(appDir, appPort, {}) | ||
}) | ||
afterAll(() => killApp(app)) | ||
|
||
it('should render the page', async () => { | ||
const $ = await get$('/hello') | ||
expect($('body').text()).toMatch(/World/) | ||
}) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"compilerOptions": { | ||
"baseUrl": ".", | ||
"esModuleInterop": true, | ||
"module": "esnext", | ||
"jsx": "preserve", | ||
"target": "es5", | ||
"lib": ["dom", "dom.iterable", "esnext"], | ||
"allowJs": true, | ||
"skipLibCheck": true, | ||
"strict": true, | ||
"forceConsistentCasingInFileNames": true, | ||
"noEmit": true, | ||
"moduleResolution": "node", | ||
"resolveJsonModule": true, | ||
"isolatedModules": true | ||
}, | ||
"exclude": ["node_modules"], | ||
"include": ["next-env.d.ts", "components", "pages"] | ||
} |