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

sails-hook-webpack

v2.0.4

Published

Webpack asset pipeline hook for Sails

Downloads

153

Readme

sails-hook-webpack

NPM version Build status Dependency Status

Webpack asset pipeline hook for Sails.

1. Install

npm install sails-hook-webpack --save

You will also need webpack and webpack-dev-server installed in your project.

npm i webpack webpack-dev-server --save

2. Configure

a. Disable the sails grunt hook.

// .sailsrc
{
  "hooks": {
    "grunt": false
  }
}

Optionally, you can also remove the default Sails tasks directory and the Gruntfile.js.

b. Set your environment variable.

By default, Sails (and express) sets NODE_ENV=development. With this setting, webpack in dev will watch for changes in the directories you specify in your config/webpack.js. In prod webpack will just run your webpack configuration.

| NODE_ENV | webpack mode | description | |:---|:---|:---| | development | webpack.watch() | Rebuilds on file changes during runtime | | staging or production | webpack.run() | Build bundle once on load. |

c. Configure Webpack

This hook uses the standard Webpack Configuration.

Below is an example of the webpack configuration file. PROJECT_DIR/config/webpack.js

// config/webpack.js
import webpack from 'webpack';

export default {
  webpack: {
    config: { },  // webpack config here
    development: { // dev server config
      webpack: { }, // separate webpack config for the dev server or defaults to the config above
      config: { // webpack-dev-server-config
        port: 3000
      }
    },
    watchOptions: {
      aggregateTimeout: 300
    }
  }
};

ES5:

// config/webpack.js
var webpack = require('webpack');

module.exports.webpack = {
    config: { },  // webpack config here
    development: { // dev server config
      webpack: { }, // separate webpack config for the dev server or defaults to the config above
      config: { // webpack-dev-server-config
        port: 3000
      }
    },
    watchOptions: {
      aggregateTimeout: 300
    }
};

3. Lift!

sails lift

Events

This hook provides events that can be listened to by using sails.on(..event, ..fn)

  • hook:sails-hook-webpack:compiler-ready - emitted when the compiler is initialised and ready, usually after the first build event.
  • hook:sails-hook-webpack:after-build - emitted after each webpack build, the event data includes the webpack build stats.

sails-linker

To replicate sails-linker functionality, check out our linker-webpack-plugin.

License

MIT

Maintained By