piotrwitek / react-redux-typescript-jspm-starter

Futuristic, bundle-free, development environment for building Component-Driven SPA with React, Redux and TypeScript - powered by JSPM (SystemJS & Rollup with tree-shaking)
https://piotrwitek.github.io/react-redux-typescript-jspm-starter/
MIT License
231 stars 43 forks source link

Remove JSPM #55

Open gilamran opened 7 years ago

gilamran commented 7 years ago

The dev speed here is amazing! But, we already have npm and yarn all around, and the jspm repo is not really active that much... Can we remove the dep. on jspm?

piotrwitek commented 7 years ago

Hi @gilamran, Good question, I was thinking about it many times, as I'm not comfortable with jspm_packages thing and would be glad to be using only node_modules directory only. I have found alternative solution already but didn't had time to experiment with it, maybe you could volunteer to investigate and share your findings here or even maybe make some contribution :)

Here is a link to library in question: https://github.com/charto/cbuild

martaver commented 7 years ago

I think this setup has great potential as @gilamran says - the dev speed is amazing and dev speed is king.

I'm going to try out this SystemJS Hot Loader approach in a new project, mostly based on your boilerplate so I'm willing to put a few hours into this topic here and there.

My interests are

If I understand correctly, most of the power of your boilerplate comes from SystemJS 0,17's new features... so where exactly is JSPM needed? E.g. with a brief look at the code, I don't see how JSPM is actually used in the HMR part of https://github.com/piotrwitek/jspm-hmr.

Also if you're using Rollup for production bundling, then shouldn't it be simple, in theory, to remove JSPM from the mix and just rely on SystemJS's features by itself?

piotrwitek commented 7 years ago

Hello @Martaver :)


On the side note, I have found a better workflow that in dev speed can even outperform this one, moreover it has a TypeScript as first-class citizen and with plugins power of webpack but with dead simple config.

I have already started experimenting with a simple boilerplate you can check it out, but the repo is really early stage but I think you can test it to know what you are dealing with and it is already fulfilling all the interests that you have mentioned :) It is based on fuse-box bundler, it's on the branch fusebox-rewrite here: https://github.com/piotrwitek/react-currency-converter/tree/fusebox-rewrite

I'm also working on webpack / fuse-box / systemjs comparison project to compare hot reload performance, build time, bundle size etc. :)

gilamran commented 7 years ago

Meanwhile I've created my own FAST starter kit :-) based on webpack. https://github.com/gilamran/fullstack-typescript

martaver commented 7 years ago

not sure what you mean in breaks editor exp

You get the TS intellisense, but none for the actual CSS which you end up writing as strings. In practice, though, the flexibility & reusability of the TS probably wins, though.

This fuse-box thing looks great. So light. So fast. Much Typescript.

Noticed some weirdness when adding/removing new files/references e.g.

Above can be resolve by a reload, which is fast, but it loses state. Does SystemJS have similar issues?

Fuse-box is really fast, but I feel like the SystemJS no-bundling approach is still more scalable.

With regards to scoped CSS - how can we get feature parity with webpack's css-modules? The Fusebox API looks great - so maybe we can fork its existing CSS loader to do it.

guillaume86 commented 7 years ago

@Martaver I also like fuse-box very much. SystemJS get pretty slow when you're getting into the hundreds of files and I really don't like that jspm folder.

Regarding your CSS workflow issues, they're probably fixable inside fuse-box. I had similar issues with SystemJS (old CSS persisting after change etc) and I just fixed the issue myself at the time.

martaver commented 7 years ago

Fusebox does seem to be in winning mode.

I just discovered they're working on version 2.0 (currently in beta) - http://fuse-box.org:3333/ One of the new features include css-modules... http://fuse-box.org:3333/plugins/cssmodules-plugin Combine that with this bad boy and we're laughing: https://github.com/Quramy/typed-css-modules

piotrwitek commented 7 years ago

@Martaver nice idea, thanks for sharing, although I still prefer typestyles, because I don't write raw css because I prefer css as object style with the full power of JS lang to write various mixins and utility functions and then higher order functions and functional composition of styles on my components rather that style classes, leveraging style re-usage as much as possible, you can do it in css as well but it is and not as powerfull, have weird syntax and I don't think you can have type checking in css mixins :)

martaver commented 7 years ago

I am coming around to the idea of typestyles too... and what you said does make a lot of sense. I think another great benefit of typestyles is that it will tree-shake all CSS that isn't used. Who knows maybe I will end up using it.

How do you use it practically, do you actually switch out CSS in real-time for UI styling updates, or more just use it as a once off style builder?

Also, how do you handle assets like background-images in your typestyles with fuse-box?

For the record, I got fuse-box 2.0 working with sass/css-modules. I based much of it on your experimental branch. I'll push a demo soon!