webpack: resolveLoader / alias with query / options
Sometimes you write a post for the ages. Sometimes you write one you hope is out of date before you hit "publish". This is one of those.
Sometimes you write a post for the ages. Sometimes you write one you hope is out of date before you hit "publish". This is one of those.
webpack 2 is on it's way. As one of the maintainers of ts-loader I've been checking out that ts-loader works with webpack 2. It does: phew!
Hands up, despite being one of the maintainers of ts-loader (a TypeScript loader for webpack) I have not been tracking webpack v2. My reasons? Well, I'm keen on cutting edge but bleeding edge is often not a ton of fun as dealing with regularly breaking changes is frustrating. I'm generally happy to wait for things to settle down a bit before leaping aboard. However, webpack 2 RC'd last week and so it's time to take a look!
Like Captain Ahab I resolve to sync the white whale that is webpack's enhanced-resolve
... English you say? Let me start again:
Occasionally I flatter myself that I'm alright at this development lark. Such egotistical talk is foolish. What makes me pause even more when I consider the proposition is this: my subconscious is a better developer than I am.
That's how I was feeling on the morning of October 6th 2016. I'd been feeling that way for some time. The target of my concern? ts-loader. ts-loader is a loader for webpack; the module bundler. ts-loader allows you use TypeScript with webpack. I'd been a merry user of it for at least a year or so. But, at that point, all was not well in the land of ts-loader. Come with me and I'll tell you a story...
Everyone loves curry don't they? I don't know about you but I'm going for one on Friday.
TypeScript 2.0 has shipped! Naturally I'm excited. For some time I've been using TypeScript to emit ES2015 code which I pass onto Babel to transpile to ES "old school". You can see how here.
I'm addicted to the ternary operator. For reasons I can't explain, I cannot get enough of:
I've been searching for a way to describe what the DefinePlugin actually does. The docs say:
Define free variables. Useful for having development builds with debug logging or adding global constants.
I'm a great lover of ES2015's Map
. However, just recently I tumbled over something I find a touch inconvenient about how you initialise a new Map
from the contents of an Array
in TypeScript.
You may know that Angular ships with a cutdown version of jQuery called jQLite. It's still possible to use the full-fat jQuery; to quote the docs:
This technique actually applies to pretty much any web stack where you have to supply templates; it just so happens that I'm using Angular 1.x in this case. Also I have an extra technique which is useful to handle the ng-include scenario.
I'd like you to close your eyes and imagine a scenario. You're handed a prototype system. You're told it works. It has no documentation. It has 0 unit tests. The hope is that you can take it on, refactor it, make it better and (crucially) not break it. Oh, and you don't really understand what the code does or why it does it either; information on that front is, alas, sorely lacking.
I hate LINQ's Enumerable.Concat
when bringing together IEnumerable
s. Not the behaviour (I love that!) but rather how code ends up looking when you use it. Consider this:
Every now and then when I try and update my packages in Atom I find this glaring back at me:
To my lasting regret, TFS 2012 has no direct support for PowerShell. Such a shame as PowerShell scripts can do a lot of heavy lifting in a build process. Well, here we're going to brute force TFS 2012 into running PowerShell scripts. And along the way we'll also get Karma test results publishing into TFS 2012 as an example usage. Nice huh? Let's go!
So you're creating a link with the Angular UI Router. You're passing more than a few parameters and it's getting kinda big. Something like this:
TypeScript first gained support for tsconfig.json
back with the 1.5 release. However, to my lasting regret and surprise Visual Studio will not be gaining meaningful support for it until TypeScript 1.8 ships. However, if you want it now, it's already available to use in beta.