Question: can babel-register apply different transforms to different paths? but that does not appear to work and hoping the babel-registers would "stack" i tried doing babel-register twice, and using ignore: on both to not collide

Asked By
Asked At
2018-01-27 06:45:32

Found 15 possible answers.

User Answered At Possible Answer
nicolo-ribaudo 2018-01-27 09:13:05 In Babel 7 there is an overrides option, which allows you to customize the plugins based on the file path.
loganfsmyth 2018-01-27 19:30:40 @tolmasky Nope they don't stack. @nicolo-ribaudo ’s suggestion would be the right one in 7.x. I've also thought of exposing an API for instantiating independent instances, but it doesn't currently exist
abiduzair420 2018-01-27 20:08:01 Hey @gregborrelly We have couple of beginner friendly issues listed in babel/website. We are re-building the existing website in reactjs. This would be a good starting point.
runn1ng 2018-01-27 20:59:31 Hello. I want to build for modern chrome, but when I use object spread, babel throws an error unless I use transform-object-rest-spread . However Chrome already has rest spread! and it will understand the syntax Oh I can just use syntax-object-rest-spread on the ... If I don't use it, Babel shows SyntaxError: src/bridge/index.js: Unexpected token (49:24) Why do I need the transform?
ljharb 2018-01-27 21:03:48 you should be using babel-preset-env it will pick the syntax and transforms that you need.
runn1ng 2018-01-27 21:04:06 I am but it throws error on the rest spread
ljharb 2018-01-27 21:04:31 hm, then that sounds like a bug in env :slightly_smiling_face:
runn1ng 2018-01-27 21:06:07 hm, if I have time, I will report it
existentialism 2018-01-27 21:14:12 to be clear, babel-preset-env doesn’t support transform-object-rest by itself, @babel /preset-env (7.0.0-beta.x) supports it via shippedProposals flag that will enable syntax / transform as needed by your targets. (and will be soon updated since it’s stage 4)
ljharb 2018-01-27 21:18:56 aha, thanks the stages are for transforms; but shouldn’t be related to parsing what syntax a given target actually ships (like if chrome 54+ ships a stage 3 proposal, and your targets are only chrome 54+, it should be included no matter what flags you have set) @existentialism altho i would expect it to support shipped syntax no matter what stage it is that makes sense
existentialism 2018-01-27 21:21:31 good point
ljharb 2018-01-27 21:22:10 so i’d still say it’s a bug in env
bradleymeck 2018-01-28 16:18:32 can i get babel to run on the client? webpack is angry, browserify is angry, everything is angry
andarist 2018-01-28 16:58:50 i think u are looking for
dev 2018-01-28 21:01:42 Is there a list somewhere of babel events emitted? @dev uploaded a file: Untitled Extra info: I'm spawning babel and not babel-node as I'm using --out-dir, I need the files written to disk and not in memory I'm spawning babel as a child process with a watch flag and I need to run another script every time babel retranspiles

Related Questions