user1283776
user1283776

Reputation: 21764

Use ES6 features and target ES5 without providing polyfills starting with a project that only has npm?

I have a simple TypeScript project that only has npm thus far, no other build tools. No webpack or babel yet.

What is the easiest good way to be able to use ES6 features and target ES5 without having to think about providing polyfills?

My impression is that babel and/or webpack might be suitable tools for this, but most guides I have found assume that one already uses webpack and some front-end framework. I haven't figured out what would be a good solution starting from a vanilla TypeScript project like I have.

Upvotes: 0

Views: 481

Answers (1)

HaneTV
HaneTV

Reputation: 926

In your tsconfig.json set target:"es5" and lib: ["es6"].

Typescript includes es6/es7 features and will transpile everything for you if you configure your tsconfig.json correctly

Upvotes: 1

Related Questions