Im using es6 feature like import and classes , now i understand that the browser doesn't support import feature and i read here. that i need to convert the es6 code into es5 , and after it i need to bundle them using Browserify or gulp, webpack, browserify, etc. Now the question going like that: the code changes everytime and i want to check my results , do i need to repeat of this procedure everytime before i want to see the results?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes, every time you change something you need to rebuild it unfortunately. Take a look at watchify or for more complex projects you might consider using grunt or any other task runner to automate the process.
// first install watchify, babelify and babel-preset-es2015
watchify script.js -o bundle.js -t [ babelify --presets [ es2015 ] ]