-
Notifications
You must be signed in to change notification settings - Fork 490
'Plugin/Preset files are not allowed to export objects, only functions' when importing JS files #382
Comments
This sounds weird, indeed, though the error is correct - the currently referenced version of See: You can get rid of this error using
Their docs mention that they for using the library with |
Thanks, you for the response. I was so happy when I left Babel world, it's so complicated (unnecessarily imo). However, Typescript is still lacking on the field of making plugins so it's kinda inevitable :/ At this point, I think I will rename those generated JS files to TS and exclude them from typescript rather than fiddling with a configuration that's already working for me. |
Just a note: Typescript supports custom transformers, but only via using its API, not via configuration file. It's just that aren't that much transformers available, since using Besides, |
Is this a bug report?
Yes.
Environment
npm ls react-scripts-ts
(if you haven’t ejected): 2.16.0node -v
: 10.4.1npm -v
: 6.1.0yarn --version
(if you use Yarn): 1.7.0Then, specify:
Steps to Reproduce
Here is the repo with reproduction: https://github.com/FredyC/lingui-typescript-cra
Install with Yarn and
yarn start
. It's not ejected.Expected Behavior
Importing JS files should work. I am assuming this is something in this fork since original CRA works with JS files just fine.
Actual Behavior
I am using Lingui project for a localization of the app. The output of that project is compiled JS files. When I try to import these files into the app, it fails with the error.
That file is indeed exporting object, but there is no reason why it would consider that as a plugin/preset file. The same thing happens when I create a simple JS file like this. It's exporting a function and yet it's wrong.
The text was updated successfully, but these errors were encountered: