You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently if we use optional chaining in our JavaScript, projects which will rely on polymer build or polymer test will fail. This is because internally those tools use Babel but they do NOT include any plugins to allow optional chaining.
In general, it's not recommended to transpile published JavaScript, since it could force consumers into supporting older browsers they don't care about, and therefore having your code run less optimally than it otherwise would.
However, due to this issue in Polymer we're essentially transpiling optional chaining code manually (using a ternary operator) and occasionally forget and break something downstream. There's also the likely possibility that optional chaining is just the tip of the iceberg in terms of modern JavaScript features we'd like to use that will break Polymer.
Ideally any transpilation we do would be very narrow -- targeting just the things we need.
Some things to keep in mind:
Babel can't transpile in place, so we'd need to move our code into a src directory and transpile to the root
That could have a negative impact on the dev experience
A tool like Rollup could help with the dev experience, although it may end up being too heavy and optimize other things we don't want it to
If we ever move to TypeScript, a compile step will be required anyway
The text was updated successfully, but these errors were encountered:
Currently if we use optional chaining in our JavaScript, projects which will rely on
polymer build
orpolymer test
will fail. This is because internally those tools use Babel but they do NOT include any plugins to allow optional chaining.In general, it's not recommended to transpile published JavaScript, since it could force consumers into supporting older browsers they don't care about, and therefore having your code run less optimally than it otherwise would.
However, due to this issue in Polymer we're essentially transpiling optional chaining code manually (using a ternary operator) and occasionally forget and break something downstream. There's also the likely possibility that optional chaining is just the tip of the iceberg in terms of modern JavaScript features we'd like to use that will break Polymer.
Ideally any transpilation we do would be very narrow -- targeting just the things we need.
Some things to keep in mind:
src
directory and transpile to the rootThe text was updated successfully, but these errors were encountered: