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

babel plugin-transfrom-typescript does not support export = syntax #16

Open
KjaerBL opened this issue Nov 20, 2019 · 6 comments · May be fixed by #28
Open

babel plugin-transfrom-typescript does not support export = syntax #16

KjaerBL opened this issue Nov 20, 2019 · 6 comments · May be fixed by #28

Comments

@KjaerBL
Copy link

KjaerBL commented Nov 20, 2019

babel-loader-ts-caveat

Hello there,

My typescript compiler is babel and using babel plugin-transform-typescript. I believe changes on this #14 would effect babel loader and started get error above.

Babel clearly warned that export = can't work for them.
https://babeljs.io/docs/en/babel-plugin-transform-typescript#caveats

I'd like to make PR for it but want to ask your opinion because you've recently removed it and introduce export = style.

What do you suggest to change? I am more than happy to contribute.
(maybe pass loader as parameter and change export expression accordingly?)

@Kjaer
Copy link

Kjaer commented Nov 21, 2019

Ups! that was mine work github, anyways I'll continue over my independent github account now on. Sorry about cross account confusion.

@Obi-Dann
Copy link
Contributor

AFAIK, babel shouldn't really do anything with d.ts files - d.ts files are declarations only, there's no actual output and babel does not do any type checking. @Kjaer would it be try just ignoring d.ts files in babel config?

@LonguCodes
Copy link

I'm also having the same problem and making babel exclude these files is not doing anything - now typescript is not picking it up. Babel is needed because it feeds the files to typescript

@Obi-Dann
Copy link
Contributor

Obi-Dann commented Aug 3, 2020

Hi everyone who still has this issue. Just added a reply to @besrezen90's PR #28 (review)

babel really should touch these files. The generated files are only use for type checking, babel does not do any typechecking so these files should ideally be just ignored for babel-loader

I am failing to replicate the issue and need some help with that.
Could you please double check that whether you include d.ts in import string, eg:

import styles from "./example.css.d.ts";
// vs
import styles from "./example.css";

In my setup, everything works fine when I don't include .d.ts, but I see the issue when d.ts is included.

@Obi-Dann
Copy link
Contributor

Obi-Dann commented Aug 3, 2020

Or it'd really help if anyone can create a sample project reproducing the issue ❤️

@Kjaer
Copy link

Kjaer commented Aug 19, 2020

I'll do ✋

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants