Webpack renames imported bindings, so
import {foo} from './bar';
becomes something like this let __webpack_require_foo_bar = _webpack_modules[5 /* foo */].bar;
So if you are paused in the debugger and want to use foo in a watch statement, or use it in a computation you'll have to reference the real source instead of the source maps.I found questions on SO, and it seems like a known and accepted problem, but I know I won't be able to sell my team on Webpack because of this.
And in the official samples (WebPack 1): https://github.com/Microsoft/TypeScriptSamples/tree/master/r...
Here's some gists showing a minimal reproduction without typescript. https://gist.github.com/anonymous/ad044363f73b845cccb4e7f225...
Specifically, look at lines 25 and 28 of lib-main.js
const foo = require('./bar').foo
it would keep the name the same?EDIT: https://github.com/jamietre/babel-plugin-transform-es2015-mo...
There is a better explanation with a partial solution.
I've been campaigning for more of a monolithic design in the TS ecosystem. Not that the architecture of the TS compiler needs to be monolithic, but rather that TS users should have a blessed and supported stack for everything. We should be able to rely on TS components for linking/packaging, polyfills, optimization, conditional compilation, minification, source map packaging, asset prepackaging and loading, ES6+ standards compliance, etc.
But since advocating for anything rhyming with -olith is heresy in the programming world, I'm not confident we'll get there.
https://gist.github.com/anonymous/ad044363f73b845cccb4e7f225...
I could just write a normal SPA and require some stuff in every route, so the client only downloads the code that is used for the current page and things worked fine without extras needed.
https://twitter.com/githubstatus/status/819940738452615168
Hilarious replies on Twitter.