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
Just won't fly in ES module-land, where something like this:
export{function}
Will blow up because it's a reserved word. (import {function} from 'testdouble' also blows up)
We can do:
exportdefault{function: tdFunction}
But then any module/bundler like webpack/rollup/browserify is going to have that default tacked onto it, which means that our distribution will be td.default.object or whatever.
I hope we can find some workaround to use ES exports exclusively and then solve this with build cleverness using one of the bundlers, but even if we do manage, having a top-level API that's a reserved word is probably not a great long-term play.
Goals:
hack up some short-term win with a bundler that'll let us still get tree shaking while using a CJS export at the top level or a way to modify the bundled content to td = td.default dynamically.
documentation change from td.function() to td.func()
figure out how soon we want to think about dropping td.function with another major bump.
The text was updated successfully, but these errors were encountered:
Terrible luck to discover this after releasing 2.0.0, but subsequent improvements to the build have made me realize that the cute way we do this:
Just won't fly in ES module-land, where something like this:
Will blow up because it's a reserved word. (
import {function} from 'testdouble'
also blows up)We can do:
But then any module/bundler like webpack/rollup/browserify is going to have that
default
tacked onto it, which means that our distribution will betd.default.object
or whatever.I hope we can find some workaround to use ES exports exclusively and then solve this with build cleverness using one of the bundlers, but even if we do manage, having a top-level API that's a reserved word is probably not a great long-term play.
Goals:
td = td.default
dynamically.td.function()
totd.func()
td.function
with another major bump.The text was updated successfully, but these errors were encountered: