Question: is there an easy way to persuade babel generator to return an expression? the thing i’m struggling with is an expression like n becomes n;
  return generate(ast, { concise: true, compact: true }).code;
    plugins: ["jsx", "flow", "objectRestSpread"]
    sourceType: "module",
const ast = babylon.parse(expression, {

Asked By
Asked At
2017-10-30 22:50:08

Found 15 possible answers.

User Answered At Possible Answer
loganfsmyth 2017-10-30 23:00:53 The generator should be fine generating an expression, but the parser expects a file's content Do you actually want useful syntax errors from this? Like what if the expression here is a string, then it'll parse as a directive, not a string literal
rajzshkr 2017-10-31 06:57:07 When i do git rebase it showing files which i didn’t changed
alexrussell 2017-10-31 15:12:30 Sorry for the seriously late reply on this, I didn’t get a notification you’d replied to me. Thanks for this. It’s just what I was looking for (and yeah the docs on the official website must be out of date, but probably do reflect v6 as you say).
loganfsmyth 2017-10-31 15:58:59 @rajzshkr What files?
rajzshkr 2017-10-31 16:07:39 It shows other files too I did rebase with master I made changes to 3 files
loganfsmyth 2017-10-31 16:34:45 seems like your rebase went wrong somewhere in there looks more like you merged, not rebased too
taion 2017-10-31 17:58:52 wow, this is so weird: 200k downloads a month, but it hasn’t been updated in 2 years
can.goektas 2017-11-01 14:15:55 hey there... :slightly_smiling_face: Maybe I didn't fully understand the use-case of babel-polyfill but is there a need for a node.console polyfill for functions like and console.groupEnd etc.?
yingying 2017-11-01 16:59:50 hi, everyone, i have a question: what diff between @babel/core with babel-core ? i am confused
ljharb 2017-11-01 17:02:44 the former is v7+, the latter is <= 6
yingying 2017-11-01 17:05:32 oh, thank you! And I am trying to use babel with preset-typescript and *rollup* and *inferno*, but I cannot succeed And when I use preset-typescript , where can i use the config of ts ? Is still tsconfig.json ?
ljharb 2017-11-01 17:14:29 no idea about those
loganfsmyth 2017-11-01 17:34:02 the rollup plugin for Babel 7.x isn't quite ready yet @can.goektas babel-polyfill is aimed at polyfilling language features, so things like console are not covered since it isn't a standardized API. it might work on some early alphas, but we broke it and haven't fixed it yet
yingying 2017-11-01 17:39:40 ok, thank you for you great work!
loganfsmyth 2017-11-01 17:40:08

Related Questions