preactjs / preact-cli

😺 Your next Preact PWA starts in 30 seconds.
MIT License
4.68k stars 376 forks source link

Use `preact` and `preact-router` from source instead of dist #636

Open prateekbh opened 6 years ago

prateekbh commented 6 years ago

Do you want to request a feature or report a bug? Bug

What is the current behaviour? We use preact and preact-router from their dist folder on npm

What is the expected behaviour? Since we transpile node_modules ourselves we should be using preact and preact_router from their source. This will have no affect on the regular bundles but will have some saving on the module bundle generated.

If this is a feature request, what is motivation or use case for changing the behaviour? Web perf

Please mention other relevant information.

lukeed commented 6 years ago

Thumbs down

prateekbh commented 6 years ago

no? because?

lukeed commented 6 years ago

Preact & Router are super optimized distributions. No user-settings are going to match it. /cc @developit

prateekbh commented 6 years ago

Now thats a thing I never knew, super interested in learning what is it?

lukeed commented 6 years ago

Follow here. IIRC it's circa ~1kb savings. This is actually (can) happen often, and is part of the reason why bundling from node_modules is not the norm... for now.

prateekbh commented 6 years ago

feel free to close :), if there's no better solution

kristoferbaxter commented 6 years ago

@developit We spoke about moving the optimizations to build size into preact-cli and applying these across all source instead of just one off packages.

Perhaps now is the time, or 3.1.0.

lukeed commented 6 years ago

I'd support that 👍 It was a thumbs-down for present situation.

My original intention for CLI was to extract some of the config into standalone chunks. I finally got around to the Babel stuff (#639), but an uglify package was on my radar too. Perhaps the mapping lives there?

developit commented 5 years ago

Another thing we can consider here is applying the Preact's minification processes to a bundled JS Modules version - with constant inlining, hoisting and a customized terser config I'm sure it'd be reasonably close to what preact ships over the wire today.