refactor: use build-in node path manipulation library

I was wondering for a while what is our policy towards usage of built-in node modules in the compiler code. Here is one example of easy replacement of a hand-crafted code with a built-in.

After this change in-browser compilation will still work with browserify but will probably fail with noder, as it doesn't polyfill native modules, if I'm not mistaken.

I'm sending this PR mostly to trigger discussion on usage of native node modules.