-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Provide an option not to use babel transform on typescript code #954
Comments
I agree. Typescript already handles transpiling code, so it doesn’t make any sense for us to run that through Babel. It just makes the bundle larger and wastes time duplicating the work that Typescript did. We should also optimize the way we handle typescript assets too. Maybe we can even take the AST from the TypeScript Compiler API, and pass it into Uglify similar to what do with Babel. |
@davidnagli The AST is different from the babel AST, so this would be impossible, however this feature can be achieved by either converting Typescript AST to Babel AST (might be slightly faster if done correctly, but way more complex). Or generate a new AST from the output (kind of what we do now but without the actual transpiling) |
I started working on this on the TypeScript plugin, see parcel-plugin-typescript#c511bd. We can create a PR for this here if you are interested. |
Ya I think that would be a great idea. I never really understood why we have a seperate plugin if we have Typescript support in the core. I think we should merge the plugin’s features into core and get rid of the plugin. @devongovett @DeMoorJasper Thoughts? |
@davidnagli The direct typescript ast transform would be nice, more predictable as well. About porting over all the plugin features wouldn’t be a good idea, the plugin seems to go beyond parcels scope, another nice feature the plugin has is typescript error handling (and i don’t mean the annoying typing warnings, but actual compile-errors) Sent with GitHawk |
Yes please add this feature. Also (and I'm not totally sure if this is related but I think so) Parcel tends to swallow very obvious syntax errors. I love Parcel - but this is a deal breaker for me. |
Parcel runs typescript compiler output through babel. Unfortunately there's no way to turn this off entirely, but with this rule it at least won't transpile down to ES5. See also parcel-bundler/parcel#954
Parcel runs typescript compiler output through babel. Unfortunately there's no way to turn this off entirely, but with this rule it at least won't transpile down to ES5. See also parcel-bundler/parcel#954
Parcel runs typescript compiler output through babel. Unfortunately there's no way to turn this off entirely, but with this rule it at least won't transpile down to ES5. See also parcel-bundler/parcel#954
Seriously, there needs to be an option to turn off babel. I don't want babel. I'm getting errors left and right because of some exotic libraries that TypeScript can handle to transpile correctly, but babel then messes up. Is there a way to disable babel via .babelrc? I couldn't find one. Please don't make me go back to webpack and its insane config. |
Parcel compiles code to the specified browser/node version target in your app. It determines this based on the |
@devongovett I created a
But unfortunately I'm still getting following error when I try to do a Uncaught ReferenceError: regeneratorRuntime is not defined It seems that |
Same. Is there no workaround for this bug/missing feature ? |
hi guyz. First thanks for the huge works, parcel is becoming my bundler n°1 ! I'd like to add a +1 for this issue. I'm using typescript for type-checking. That's why I expect parcel to
But as explained here babel is only meant for transportation, not type checking. So typescript looks like the only way to go. Currently I am using tsc and parcel in concurrent thread, to have all features, as explained in this repo |
I think we need to create a bundler which works out of the box with Typescript and doesn’t use Babel when not needed. |
That's what we need, yet another bundler! |
At this moment, the workaround is adding the following lines to the package.json: "browserslist": [
"last 1 Chrome version"
], |
Parcel runs typescript compiler output through babel. Unfortunately there's no way to turn this off entirely, but with this rule it at least won't transpile down to ES5. See also parcel-bundler/parcel#954
I guess it can be closed now that #6230 is implemented. |
Oh this was possible from the start with Parcel 2, can definitely be closed |
Starting with parcel 1.6, all javascript code is transformed by babel.
Our project (https://github.com/propelml/propel) uses typescript, which already knows how to target different versions of javascript/ecmascript.
Therefore the babel transform is unnecessary -- and it actually creates problems because babel generates code that is dependent on regeneratorRuntime.
Could there be an option to disable the babel transform (either for typescript or for all javascript code)?
The text was updated successfully, but these errors were encountered: