This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
'Plugin/Preset files are not allowed to export objects, only functions' when importing JS files #382
Open
Description
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.0
Then, specify:
- Operating system: Windows 10 x64
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.
./src/locale/en/messages.js
Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In D:\workspace\github\lingui-typescript-cra\node_modules\babel-preset-react-app\index.js
at Array.map (<anonymous>)
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.
module.exports = function() {
console.log(arguments)
}
Metadata
Metadata
Assignees
Labels
No labels