Hacker News new | ask | show | jobs
by teebot 3300 days ago
The await import to lazy load modules is quite impressive. TypeScript goes more and more beyond the compile-to-js promise
2 comments

Dynamic imports is standards-track JS :) http://2ality.com/2017/01/import-operator.html
It might be better to have runtime system load code dynamically when necessary, without programmer to care about this, e.g. on first invocation, maybe pre-loading it based on call statistics from previous app runs. People implement this already (I tried this too - https://github.com/avodonosov/pocl)
I wonder how to get it all working with webpack? Does it use require.ensure?
Webpack 2 supports import()
Yup - one of the maintainers of ts-loader here. I haven't had chance to test it yet but I'm pretty confident this should just work with ts-loader (and awesome-typescript-loader as well I should think)
Hey, can I ask you a quick question (and I understand if you can't respond). I'm using React + TypeScript for some server-side stuff, but because I'm using style-loader/css-loader, I have to use webpack.

Everything works, including sourcemaps, but when I debug using VSCode, setting a breakpoint puts me in a 'read-only' version of the file. It's not a lot of 'work' to switch to the actual file, but long-term it's hella inconvenient.

Is there a way to get VSCode (or another editor) to drop me into the actual file, or is this just a consequence of using webpack?