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

Enable AST explicitly #48

Merged
merged 1 commit into from
Jul 19, 2018
Merged

Conversation

shirohana
Copy link
Contributor

When using with @babel/core, an error occurred because generating AST was disabled in default since Babel goes to v7.

In Babel 6, AST is enabled in default: babel-core#options

But is disabled in Babel 7: @babel/core#options

2018-07-01 11 13 33

Although this plugin seems will not get maintain of compatibility with babel 7 right now (#30), but it still can used with babel 7 by a little bit change. Hope you can release a patch version for me 😢

Minimal package.json:

...
"@babel/core": "^7.0.0-beta.51",
// This module exports `@babel/core` as `require('babel-core')` so we can
// use `babel-plugin-transform-react-pug` with Babel 7
"babel-core": "7.0.0-bridge.0",
"babel-plugin-transform-react-pug": "^6.0.0",
...

@shirohana
Copy link
Contributor Author

Excuse me (´・ω・`)?

@ForbesLindesay ForbesLindesay merged commit 4d7e171 into pugjs:master Jul 19, 2018
@ezhlobo
Copy link
Member

ezhlobo commented Jul 19, 2018

@shirohana sorry for being unanswered and thanks for your message.

@ForbesLindesay I think we should merge this. Also if @shirohana will be able to provide us necessary changes to support babel@7 we can start publishing new version as well (like -beta version for @7).

@shirohana
Copy link
Contributor Author

I'm using @babel/[email protected] in my project currently, it renders correctly and no error or warning is shown.

I'll continuously use and try its functionality in my project, with something like redux-*, react-router, Flowtype etc.

Minimal setup to work in my case:

package.json

{
  "devdependencies": {
    "@babel/core": "^7.0.0-beta.51",
    "@babel/plugin-transform-react-jsx": "^7.0.0-beta.51",
    "@babel/plugin-transform-runtime": "^7.0.0-beta.51",
    "@babel/preset-env": "^7.0.0-beta.51",
    "@babel/runtime": "^7.0.0-beta.51",
    "babel-core": "7.0.0-bridge.0",
    "babel-plugin-transform-react-pug": "git://github.com/shirohana/babel-plugin-transform-react-pug.git#dist"
  }
}

.babelrc.js

module.exports = function (api) {
  api.env()
  return {
    presets: [
      ['@babel/env', { useBuiltIns: 'entry' }]
    ],
    plugins: [
      ['babel-plugin-transform-react-pug'],
      ['@babel/plugin-transform-react-jsx'],
      ['@babel/plugin-transform-runtime']
    ]
  }
}

@ezhlobo ezhlobo mentioned this pull request Aug 23, 2018
@ezhlobo
Copy link
Member

ezhlobo commented Aug 23, 2018

@shirohana hey, just want to inform you, that we published new version (6.0.1) with your fix. Thank you ;).

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 this pull request may close these issues.

3 participants