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

laravel-mix-ignore

v1.0.1

Published

Plugin for ignoring module(s) from being bundled with IgnorePlugin.

Downloads

1,502

Readme

Ignore specific module(s) when bundling assets, using Laravel Mix.

Read more about how ignoring module(s) work with the IgnorePlugin.

Installation

npm install laravel-mix-ignore --save-dev

Parameters

| Parameter | Type | |---|---| | resource | String | RegExp | Function | | context (optional) | String | RegExp | Function |

When a String is given for either parameter, it's automatically converted to a RegExp instance.

So, target/with/slashes is converted to: /target\/with\/slashes/.

Usage

The resource parameter is tested against the string passed to require or import within the source code where the import is taking place.

const mix = require('laravel-mix');
require('laravel-mix-ignore');

// ignore bundling the following module
mix.ignore('import-or-require-statement-to-ignore', 'only-when-in-this-context');

Following with the official documentation on the IgnorePlugin, you can also pass in filter functions for either the resource or context parameters.

As stated in the documentation, the filter function(s) must return a Boolean value for the plugin to evaluate.

mix.ignore(
    resource => resource == 'import-or-require-statement-to-ignore',
    context => context == 'when-in-this-folder' // optional (without will be unconstrained)
);

Adapting the official documentation's examples when dealing with moment locales, in order to properly ignore bundling them when importing or requiring moment, do the following:

With the following import statement with how moment imports its locale(s)...

require('./locale/' + name);

...the first resource parameter should match against ./locale and the second context parameter should specify the directory or directories from where the import took place. The following will cause the locale files to be ignored in the proper context:

mix.ignore(
    /^\.\/locale$/,
    /moment$/
);