@putout/plugin-webpack
🐊Putout plugin helps with migration to latest webpack
Last updated 2 years ago by coderaiser .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install @putout/plugin-webpack 
SYNC missed versions from official npm registry.

@putout/plugin-webpack NPM version

At its core, webpack is a static module bundler for modern JavaScript applications. When webpack processes your application, it internally builds a dependency graph from one or more entry points and then combines every module your project needs into one or more bundles, which are static assets to serve your content from.

(c) webpack.js.org

🐊Putout plugin helps to migrate to latest webpack version.

Install

npm i @putout/plugin-webpack -D

Rules

{
    "rules": {
        "webpack/apply-externals": "on",
        "webpack/convert-loader-to-use": "on",
        "webpack/convert-query-loader-to-use": "on",
        "webpack/convert-node-to-resolve-fallback": "on"
    }
}

convert-loader-to-use

Fixes webpack comilation error: Compiling RuleSet failed: Exclamation mark separated loader lists has been removed in favor of the 'use' property with arrays (at ruleSet[1].rules[1].loader: style-loader!css-loader!clean-css-loader)

❌ Example of incorrect code

const rules = [{
    test: /\.css$/,
    loader: 'style-loader!css-loader!clean-css-loader',
}];

βœ… Example of correct code

const rules = [{
    test: /\.css$/,
    use: [
        'style-loader',
        'css-loader',
        'clean-css-loader',
    ],
}];

convert-query-loader-to-use

Fixes webpack comilation error: Compiling RuleSet failed: Query arguments on 'loader' has been removed in favor of the 'options' property.

❌ Example of incorrect code

const rules = [{
    test: /\.(png|gif|svg|woff|woff2|eot|ttf)$/,
    loader: 'url-loader?limit=50000',
}];

βœ… Example of correct code

const rules = [{
    test: /\.(png|gif|svg|woff|woff2|eot|ttf)$/,
    use: [{
        loader: 'url-loader',
        options: {
            limit: 50_000,
        },
    }],
}];

convert-node-to-resolve-fallback

Fixes webpack comilation error:

Module not found: Error: Can't resolve 'path'`

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

❌ Example of incorrect code

module.exports = {
    node: {
        path: 'empty',
    },
};

βœ… Example of correct code

module.exports = {
    resolve: {
        fallback: {
            path: false,
        },
    },
};

convert-externals

Fixes webpack comilation error:

[DEP_WEBPACK_EXTERNALS_FUNCTION_PARAMETERS] DeprecationWarning: The externals-function should be defined like ({context, request}, cb) => { ... }

Checkout in 🐊Putout Editor.

❌ Example of incorrect code

module.exports = {
    externals: [
        externals,
    ],
};

function externals(context, request, callback) {}

βœ… Example of correct code

module.exports = {
    externals: [
        externals,
    ],
};

function externals({context, request}, callback) {}

License

MIT

Current Tags

  • 3.0.0                                ...           latest (2 years ago)

8 Versions

  • 3.0.0                                ...           2 years ago
  • 2.0.0                                ...           2 years ago
  • 1.4.0                                ...           4 years ago
  • 1.3.1                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
Maintainers (1)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (8)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE