Skip to content

journal 2020 08 24: Giving up Hegel, using TypeScript

Eason Chen edited this page Aug 24, 2020 · 2 revisions

Yesterday I tried out doing some simple things using Hegel, but came across a tonne of errors, which I referred to here:

Hegel's philosophy (safety, strictness, powerful type-inference) suits my taste much better; however I need something that works right now. Unfortunately, that means I have to use TypeScript.

TypeScript etc

I've had more success today trying to set up TypeScript, Rollup, and ESLint manually. I basically started with the huge tsconfig reference. Here is the relevant reading:

TypeScript:

Rollup:

ESLint:

Workflow

I run everything manually; no watch mode. I point Rollup's input param to TypeScript's output directory, and use tsc && rollup -c (via npm run or npx) as my build command.

There is no consideration given to minification, almost not even source maps. This shouldn't be an issue, as I plan for a workflow driven by ts-node REPL and tests, and that when a bundle is built, it should "Just Work".

With Rollup set up properly, I no longer have that well-known ( https://github.com/rollup/rollup/issues/487 ) and yet nondescript error:

Uncaught ReferenceError: process is not defined

Beforehand:

image

After adding rollup-plugin-node-globals:

image

This is sufficiently good. I can carry on with doing my usual TypeScript things, and starting to explore React per-se.

Clone this wiki locally