-
Notifications
You must be signed in to change notification settings - Fork 27
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: allow overrding tsconfig path #489
Conversation
test/integration.test.ts
Outdated
{ | ||
name: 'tsconfig-override', | ||
dir: 'tsconfig-override', | ||
args: ['--tsconfig', 'tsconfig.build.json'], | ||
async expected(dir) { | ||
expect(await existsFile(join(dir, './dist/index.js'))).toBe(true) | ||
expect(await existsFile(join(dir, './dist/index.d.ts'))).toBe(true) | ||
}, | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't know a nice simple test here to assure we did use the provided tsconfig path. ideas?
test/integration.test.ts
Outdated
name: 'tsconfig-override', | ||
dir: 'tsconfig-override', | ||
args: ['--tsconfig', 'tsconfig.build.json'], | ||
async expected(dir) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One way is to test target
, you can do es5, then you get var
in the output, and another one is still es8 by default.
We're using the new way to write interagtion test now, you can checkout #484 to see how we do it now. Basically have a new index.test.ts
under that folder and put test there. so we can run them as a standalone test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rewrote the test!
join(dir, './dist/index.js'), | ||
'utf-8', | ||
) | ||
expect(content).toContain('export { index as default };') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the checking result is reversed? this should be es5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the outputs I'm getting 👀
// target: esnext
var index = (()=>'index');
export { index as default };
// target: es5
function index() {
return "index";
}
export { index as default };
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i agree it kinda does seem weird though...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see 👍
I changed to class, it looks easier to understand between function
and class
now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Allows using a custom path for tsconfig during build. Useful if you for example have one tsconfig for editor experience and a different one for build
(ref https://github.com/pingdotgg/uploadthing/tree/main/packages/uploadthing - base tsconfig has path overrides to resolve source code types during dev, but we don't want the built output to use those paths)