ttag-org / babel-plugin-ttag

:blue_book: ttag - library for extracting and resolving gettext translations extract es6 localization
https://ttag.js.org
MIT License
28 stars 27 forks source link

Conflict between `babel/preset-env` and `transform-template-literals` #138

Open opyh opened 5 years ago

opyh commented 5 years ago

While using babel/preset-env to transpile our builds for IE11, I just stumbled upon an issue:

When using babel-plugin-ttag and transform-template-literals plugins at the same time, the end result of my build still contains untranspiled template literals. transform-template-literals is necessary to get an IE11 compatible transpiled code and automatically included when using Babels preset-env plugin with ie >= 11 in the browserslist string.

I don't know if this is a bug in babel-plugin-ttag or if there is a way to correctly configure both plugins to work at the same time, I just wanted to document this in case somebody else stumbles upon a IE11 console saying SCRIPT1014: Invalid character while using this plugin. By removing babel-plugin-ttag from my .babelrc, the issue goes away and the transpiled code does not contain template literals anymore.

To keep babel-plugin-ttag and still have transpiled code, this is my workaround for now:

Maybe there is a better way to achieve the same?

(PS: We're using ttag successfully to translate wheelmap.org to more than 30 languages. Thanks for your work!)