0.0.1 • Published 4 years ago

webpack-assert-tree-shaking-plugin v0.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
4 years ago

webpack-assert-tree-shaking-plugin

A webpack plugin that asserts the specified files are tree shaken

Install

npm install -D webpack-assert-tree-shaking-plugin
yarn add -D webpack-assert-tree-shaking-plugin

Usage

In your webpack.config.js,

const { WebpackAssertTreeShakingPlugin } = require('webpack-assert-tree-shaking-plugin');

module.exports = {
    /* your configuration */

    plugins: [
        /* other plugins */

        new WebpackAssertTreeShakingPlugin([
            {
                // Specify a module path that should be tree shaken
                modulePath: A_FILE_PATH_TO_BE_TREE_SHAKEN,
            },
            {
                modulePath: A_FILE_PATH_TO_BE_TREE_SHAKEN,
                // You can also specify variable names that should be tree shaken
                values: ['A_EXPORTED_VARIABLE_NAME_TO_BE_TREE_SHAKEN' /* ... */],
            },
        ]),
    ],
};