Snowpack: Improve optimize story for unbundled builds

Created on 19 Aug 2020  路  6Comments  路  Source: snowpackjs/snowpack

Background

Currently, we support most optimizations through the use of a bundler plugin like Webpack. For unbundled builds, we only really support minifying JS, but not much else.

This issue represents the work needed to start building performant, unbundled apps.

Would love any help on pieces of this, if anyone is interested in tackling!

/cc @drwpow

TODO

  • [x] Move existing build "minify" behavior into an optimize() plugin, internally
  • [x] Decide how to configure this plugin: buildOptions.optimize = { ... }?
  • [x] https://github.com/pikapkg/snowpack/pull/1034 - Add to that plugin the ability to compile to either a browserslist target string or an ECMAScript target year. (more background here: https://github.com/pikapkg/snowpack/discussions/834)
  • [x] https://github.com/pikapkg/snowpack/pull/1051 Minify CSS & HTML as well.
  • [x] Future: Add modulepreload tags to HTML files, based on the import graph that we detect of their scripts
help wanted

Most helpful comment

Dang it, I released a user land plugin for HTML minification that I had been using on my personal site before I saw this issue. Can't wait to delete it 馃槃

All 6 comments

Dang it, I released a user land plugin for HTML minification that I had been using on my personal site before I saw this issue. Can't wait to delete it 馃槃

@jaredLunde any interest in porting it into our @snowpack/plugin-optimize plugin??

For sure! I just took a peek at the plugin and it looks pretty straightforward. Anything specifically you'd like me to know before diving into a PR?

Awesome, thank you!

Yup, the optimize() hooks is pretty straightforward. @drwpow may have some tips but feel free to take a stab at it!

@jaredLunde I just realized that this is pretty important for us to get the new optimize logic released, so I ended up spinning up #1051 to tackle CSS & JS minification together. Thanks again for offering to help, and would love your review on that PR!

All good! Happy to see the plugin come to fruition.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

FredKSchott picture FredKSchott  路  5Comments

FredKSchott picture FredKSchott  路  3Comments

FredKSchott picture FredKSchott  路  4Comments

daniele-orlando picture daniele-orlando  路  6Comments

FredKSchott picture FredKSchott  路  6Comments