pugjs / babel-plugin-transform-react-pug

A plugin for transpiling pug templates to jsx
MIT License
808 stars 46 forks source link

Fix babel using unexpected configs in Babel@7 #65

Closed shirohana closed 5 years ago

shirohana commented 6 years ago

Error occurred when using Babel@7 with new babel.config.js file.

It works correctly when using .babelrc or .babelrc.js as babel config filename, babel-plugin-transform-react-pug will not deal with these file, but babel.config.js.

2018-09-10 3 27 57

The solution is add configFile: false into parse options:

https://babeljs.io/docs/en/next/options#configfile

shirohana commented 6 years ago

btw, the pic above didn't tell anything, just the errors confused me the whole morning (˘̩̩̩ ω ˘̩ƪ)

ezhlobo commented 6 years ago

@shirohana thanks for this. Do you know why tests fail?

shirohana commented 6 years ago

Because your tests dependent on babel@^6, which has no supports of configFile parameter.

We got 2 ways to go:

  1. Upgrade peer-dependencies and dev-dependencies, then bump a major release
  2. Check user's babel version manually to judgement add configFile: false or not

I prefer the first option which is a better choice (๑ơ ω ơ)

ezhlobo commented 6 years ago

@shirohana I agree with the first option and I'd like to move forward with babel@7. But for me personally bumping babel's version is not a trivial task. If you have time for this, that would be a great help, otherwise that transition is going to take some time.

//CC @ForbesLindesay

ForbesLindesay commented 6 years ago

I agree, we should bump the babel version. It should just be a case of bumping the version and updating our dependencies, but you never know :)

shirohana commented 6 years ago

Sorry that I missed these comments (ノω・。)

I'm during a hard time in my job this month, and may not help until me spend the hardship (´-ωก`)

Maybe we can remind users to use .babelrc.js in README temporarily before we done the job, to prevent unexpected errors?

ezhlobo commented 5 years ago

@shirohana thank you for your PRs, they helped me to make the upgrade.

Here is the PR: #78