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

@swissquote/crafty-runner-webpack

v1.27.0

Published

Webpack is an asset bundler, its purpose is to compile your JavaScript code to be the most efficient possible for production.

Downloads

195

Readme

Description

Webpack is an asset bundler, its purpose is to compile your JavaScript code to be the most efficient possible for production.

[TOC]

Features

  • Bundle your JavaScript using EcmaScript 2015 imports or commonjs imports
  • Your code is Uglified after compilation.
  • Configurable output formats
  • Watch mode, re-compiles your files on changes
  • Analyze your bundles with --analyze which will create a stats file next to the generated JavaScript
  • Profile Webpack's execution time with --analyze

Configuration

Options

We don't provide any option to configure Webpack outside bundles, but as crafty.config.js is considered as a preset, you can define the webpack override method in your configuration file and change the configuration to your needs.

Check the Extending the configuration section below for more information on that.

Bundle Options

| Option | Type | Optional ? | Runner | Description | | --------------- | ------------------- | ---------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | | hot | Boolean | Yes | Webpack | Allows to use Hot Module Replacement in watch mode (false by default) | | libraryTarget | String | Yes | Webpack | Define the library type to export. By default we use amd. Possible values | | library | String | Yes | Webpack | Define the library name for the Webpack module or export. | | externals | Array<String> | Yes | Webpack | Extends the list of provided libraries (Webpack understands both globs and strings) |

Extending the configuration

Extending Webpack's configuration can be done in two different way, either with a webpack.config.js file or with the webpack extension point

webpack.config.js

In this solution, you have to create a webpack.config.js file next to your package.json.

This file should contain the configuration you wish to change, the rest being already configured inside Crafty we will merge your custom settings.

This solution is a bit less powerful than the extension point: You can replace configuration but you can't remove loaders and you can't change the loader's configuration.

webpack(crafty, bundle, chain)

Each preset and crafty.config.js can define the webpack(crafty, bundle, chain) function to override Webpack configuration.

Webpack's configuration is built using webpack-chain which is a configuration builder.

module.exports = {
  /**
   * Represents the extension point for Webpack configuration
   * @param {Crafty} crafty - The instance of Crafty.
   * @param {Object} bundle - The bundle that is being prepared for build (name, input, source, destination)
   * @param {WebpackChain} chain - The current Webpack configuration using `webpack-chain`
   */
  webpack(crafty, bundle, chain) {
    // Change any value of the chain object

    // For example, adding supported extensions to the resolution
    chain.resolve.extensions.add(".ts").add(".tsx").add(".mts").add(".cts");

    // For example to add a reverse proxy
    chain.devServer.set("middleware", (app, builtins) => {
    app.use(builtins.proxy('/hey', { target: 'https://google.com' }));
});

  }
};