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

ERROR: The 'decorators' plugin requires a 'decoratorsBeforeExport' option #515

Closed
matheusrezende opened this issue Aug 22, 2018 · 16 comments

Comments

@matheusrezende
Copy link

matheusrezende commented Aug 22, 2018

Got this error with node version:

⇒  node -v
v10.9.0
⇒  npm -v
6.2.0
⇒  importjs --version
3.1.0

Error Message

⇒  ./importjs.js fix ~/www/src/Components/FavoriteITem/FavoriteItem.component.js
Error: The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean.

Current Solution

  • Installed the version 3.0.0
@matheusrezende matheusrezende changed the title ERROR: The 'decorators' plugin requires a 'decoratorsBeforeExport' option, whose value must be a boolean. ERROR: The 'decorators' plugin requires a 'decoratorsBeforeExport' option Aug 22, 2018
@trotzig
Copy link
Collaborator

trotzig commented Aug 22, 2018

This seems to be a typescript issue. Let's see if @williamboman has any input here.

@williamboman
Copy link
Contributor

At first glance, this is probably due to the upgrade to babel 7? Also, decorators are a bit tricky as the initial, now deprecated, babel decorator plugin is non-spec compliant so import-js might not be able to parse projects using the deprecated decorator plugin.

@matheusrezende
Copy link
Author

matheusrezende commented Aug 23, 2018

yes it is related the upgrade to babel, I installed the version that does not support typescript and it is working

I tried forking and fixing it, but if I downgrade babel it throws me an error related to babel-plugin-transform-decorators-legacy

@linchen2chris
Copy link

I am using babel v6.26.3, and also has this issue

@trotzig
Copy link
Collaborator

trotzig commented Aug 23, 2018

It’s likely that we’ll see issues like these with the babel upgrade. I see a few ways to solve this:
A) detach the bits that parse files to some kind of plugin
B) detect issues with parsing and fall back to an earlier babel version
C) mention compatibilities in the README and direct people to use an earlier version

A is potentially the ”right” solution but requires a significant chunk of work.

B is potentially complicated, is likely to lead to other issues down the line.

C is the simplest option, perhaps we can pair that with providing an actionable error message when issues occur.

What do you folks think?

@williamboman
Copy link
Contributor

This should only be an issue with the compatibility between the new decorator babel plugin and the decorator-legacy babel plugin, right?

@trotzig
Copy link
Collaborator

trotzig commented Aug 23, 2018

Yeah, so far that's the only issue I've seen reported.

@matheusrezende
Copy link
Author

matheusrezende commented Aug 24, 2018

While the issue is not fixed yet it would be great to have the info in the README pointing users to the previous version.

@trotzig
Copy link
Collaborator

trotzig commented Aug 24, 2018

I added something to the README in 655df38. Let's keep an eye out for more of these issues and potentially implement a better fix at that time.

@roelandmoors
Copy link

roelandmoors commented Aug 30, 2018

I have the same error. I'm using Create React App 2 (2.0.0-next.3e165448) which includes babel 7.
How can I fix this? I don't use typescript or flow. I tried with import-js 3.1.0 (global and local)
I can't use 3.0.0 because I use React fragments (short syntax) and babel 6 fails on that.

This seems related: babel/babel#8562

@trotzig
Copy link
Collaborator

trotzig commented Sep 5, 2018

I'm reopening this as we're seeing quite a few reports from different import-js plugins.

@gotjoshua
Copy link

I would love to help debug, but I have no clue what info would help!

I am running a meteor project (and meteor seems to have a quite interesting relationship with babel) but the most weird thing is that my colleague (in the same repo with mostly the same plugins) can upgrade to 0.15.0 but i needed to downgrade to avoid this error.

Let me know what stack traces you need and what other info and I can try to provide it...

Cheers!

@trotzig
Copy link
Collaborator

trotzig commented Sep 5, 2018

Since we started using babel 7 before it was officially released, it would be interesting to know if bumping a few @babel/* dependencies could fix the issue. The way to test that would be to git clone the import-js project, run npm install, then run npm link from inside the import-js folder (which will cause the cloned version to be available as the importjs binary). You might also have to run npm run build before you can try things. If you are able to reproduce the bug, try editing package.json to use regular babel 7 (instead of pre-releases/beta). Then npm install and try again.

@gotjoshua
Copy link

when i clone into the atom-import-js/node-modules/import-js folder and run the above three commands, i get the following error on start up in atom:

Cannot find module '~/.atom/packages/atom-import-js/node_modules/import-js/node_modules/sqlite3/lib/binding/electron-v2.0-darwin-x64/node_sqlite3.node'

but this seems unrelated to the previous error about decorators

gotjoshua added a commit to onezoomin/import-js that referenced this issue Sep 8, 2018
Fix Galooshi#515 Add required option to decorator plugin
@gotjoshua
Copy link

quick report:
merging wyuenho's changes combined with:
ln -s import-js/node_modules/sqlite3/ sqlite3/
from my .atom/packages directory has fixed the issue for me!

trotzig added a commit that referenced this issue Sep 10, 2018
Fix #515 Add required option to decorator plugin
@jcabrerazuniga
Copy link

any ideas about how to set that decoratorsBeforeExport value in webpack.config?

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

No branches or pull requests

7 participants