Open drywolf opened 8 years ago
After some hours of debugging webpack, babel and awesome-typescript-loader I was able to come up with a solution that allows me to use the ES6 features that I was looking for (async/await & generators/yield syntax) in combination with TypeScript & React.js
Some sample code and the general build configs can be found at this repository: typescript-webpack-generator-sample
To get it to work I had to jump through a couple of hoops though (as noted in the repos' README)
Copy pasted from the README...
The important parts in the project setup to get async/await & generator support working are:
.babelrc
config file with the es2015 preset
and regenerator transform
plugin"babel-polyfill"
in webpack.config.js
build configurationawesome-typescript-loader
for webpack
fixes\awesome-typescript-loader
directoryawesome-typescript-loader
is resolvedRequire guard added in v0.18.0, so you don't need fixes\awesome-typescript-loader
anymore. Please try.
Hi, I am trying to use ES6 generator syntax with function* & yield, but I get the following error:
(The code sample that I use for testing is taken from the babel examples page)
In my tsconfig/awesome-ts-loader config I try to target es5 since I want to run the compiled code in the browser.
@s-panferov Is this error also caused by webpack, or is it a different cause ?
PS: before this code I already tried out async & await code with the same tsconfig/awesome-ts config which worked just fine.
(maybe this issue is related to #112 ?!)
Thanks