npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

spike-optimize

v0.1.2

Published

bleeding edge performance optimization for spike

Downloads

19

Readme

Spike Optimization Plugin

npm tests dependencies coverage

A plugin that provides bleeding edge performance optimizations for spike.

Note: This project is in early development, and versioning is a little different. Read this for more details.

Installation

npm install spike-optimize -S

Usage

Currently, spike-optimize provides a simple interface through which you can enable scope hoisting, aggressive splitting for http/2, and hashed asset processing -- features that are on the more advanced side of webpack configuration, but which can be set up with simple boolean options through this plugin. For example:

const optimize = require('spike-optimize')

module.exports = {
  // ... your config ...
  afterSpikePlugins: [
    ...optimize({
      scopeHoisting: true,
      minify: true,
      aggressiveSplitting: true // or set your size limits ex. [30000, 50000]
    })
  ]
}

NOTE: Notice that optimize actually returns an array of plugins, so the instantiation is slightly different here.

Out of the box, this plugin will force webpack to use chunkhash naming optimized for long term cacheing. Now, as soon as you are using hash naming, you no longer have a way to include the scripts on your page, since they are named randomly. However, this plugin will scan your pages and detect when you are using the assets as they are named in your entries automatically, then replace them with the correct path. So you can still include the script like this:

<body>
  <!--  ... your code ... -->
  <script src='/js/main.js'></script>
</body>

Any scripts that webpack processes will be transformed such that the naming is correct if you are using hash naming, and if it has been split into multiple outputs, it will be replaced by multiple script tags. So for example, if you have aggressiveSplitting set to true, your result might look like this:

<body>
  <!--  ... your code ... -->
  <script src='/js/kj2b34k32b44nio.js'></script>
  <script src='/js/nro32uuwebfssdf.js'></script>
  <script src='/js/n23ouenwoubsfd3.js'></script>
</body>

In this case, your bundle has been split into a couple files to optimize http/2 load speed, and each file has been renamed to a hash. If you just use the plugin with default settings, it won't split your output and it will look more like this:

<body>
  <!--  ... your code ... -->
  <script src='/js/kj2b34k32b44nio.js'></script>
</body>

Note that at the moment, these optimizations are only available for javascript, not css. Aggressive splitting and hash naming could be marginally useful for css, and I will consider adding this in the future. In the meantime, PRs accepted!

Also note that this plugin will significantly slow down compilation due to the extra optimizations, and is only recommended to be used in production (but please test it locally before going live).

Options

| Name | Description | Default | | ---- | ----------- | ------- | | scopeHoisting | Configures webpack to use scope hoisting. | | | aggressiveSplitting | Configures webpack to use aggressive splitting for optimized h2. | | | minify | Activates the uglifyjs plugin for minifying your js | |

License & Contributing