Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose tsconfig command #652

Merged
merged 4 commits into from Jun 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions src/cli-main.ts
Expand Up @@ -79,6 +79,7 @@ export async function main(options: Options = {}) {
default: 'node',
})
.option('--loader <ext=loader>', 'Specify the loader for a file extension')
.option('--tsconfig <filename>', 'Use a custom tsconfig')
.option('--config <filename>', 'Use a custom config file')
.option('--no-config', 'Disable config file')
.option('--shims', 'Enable cjs and esm shims')
Expand Down
23 changes: 19 additions & 4 deletions test/index.test.ts
Expand Up @@ -279,7 +279,7 @@ test('import css', async () => {
`,
'foo.css': `
$color: blue;

.foo {
color: $color;
}
Expand All @@ -297,7 +297,7 @@ test('import css in --dts', async () => {
'input.ts': `
import './foo.css'
`,
'foo.css': `
'foo.css': `
.foo {
color: blue
}
Expand Down Expand Up @@ -439,6 +439,21 @@ test('onSuccess', async () => {
expect(logs.includes(randomNumber)).toEqual(true)
})

test('custom tsconfig', async () => {
await run(
getTestName(),
{
'input.ts': `export const foo = 'foo'`,
'tsconfig.build.json': `{
"compilerOptions": {
"baseUrl":"."
}
}`,
},
{ flags: ['--tsconfig', 'tsconfig.build.json'] }
)
})

test('support baseUrl and paths in tsconfig.json', async () => {
const { getFileContent } = await run(getTestName(), {
'input.ts': `export * from '@/foo'`,
Expand Down Expand Up @@ -751,7 +766,7 @@ test('es5 target', async () => {
export class Foo {
hi (): void {
let a = () => 'foo'

console.log(a())
}
}
Expand Down Expand Up @@ -848,7 +863,7 @@ test('use rollup for treeshaking', async () => {
getTestName(),
{
'input.ts': `
export { useRoute } from 'vue-router'
export { useRoute } from 'vue-router'
`,
},
{
Expand Down