Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kherock/webpack-pnp-unplugged-externals

Exclude unplugged PnP packages from the webpack bundle
https://github.com/kherock/webpack-pnp-unplugged-externals

Last synced: about 1 month ago
JSON representation

Exclude unplugged PnP packages from the webpack bundle

Awesome Lists containing this project

README

        

[![npm][npm]][npm-url]
[![node][node]][node-url]
[![deps][deps]][deps-url]
[![downloads][downloads]][downloads-url]





webpack Plug'n'Play unplugged externals


Exclude unplugged PnP packages from the webpack bundle


Install

```bash
yarn add --dev webpack-pnp-unplugged-externals
```

Usage

**webpack.config.js**

```js
const pnpUnpluggedExternals = require('webapck-pnp-unplugged-externals');

module.exports = {
// ...
externals: [pnpUnpluggedExternals()],
};
```

To explicitly declare a package as external, simply `yarn unplug` it from the
workspace! (or just add it to the webpack `externals` array, like usual.)

It's recommended to use this library in conjunction with
[`pnp-package-json-webpack-plugin`](https://github.com/kherock/pnp-package-json-webpack-plugin).
Together, it's possible to create a minimal package.json containing only
dependencies that webpack normally can't handle, e.g. packages that compile
native addons, regardless of where they appear in your dependency tree.

[npm]: https://img.shields.io/npm/v/webpack-pnp-unplugged-externals.svg
[npm-url]: https://npmjs.com/package/webpack-pnp-unplugged-externals

[node]: https://img.shields.io/node/v/webpack-pnp-unplugged-externals.svg
[node-url]: https://nodejs.org

[deps]: https://david-dm.org/kherock/webpack-pnp-unplugged-externals.svg
[deps-url]: https://david-dm.org/kherock/webpack-pnp-unplugged-externals

[downloads]: https://img.shields.io/npm/dt/webpack-pnp-unplugged-externals.svg
[downloads-url]: https://npmjs.com/package/webpack-pnp-unplugged-externals