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.
npm i @putout/plugin-webpack -D
{
"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"
}
}
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)
const rules = [{
test: /\.css$/,
loader: 'style-loader!css-loader!clean-css-loader',
}];
const rules = [{
test: /\.css$/,
use: [
'style-loader',
'css-loader',
'clean-css-loader',
],
}];
Fixes webpack comilation error: Compiling RuleSet failed: Query arguments on 'loader' has been removed in favor of the 'options' property
.
const rules = [{
test: /\.(png|gif|svg|woff|woff2|eot|ttf)$/,
loader: 'url-loader?limit=50000',
}];
const rules = [{
test: /\.(png|gif|svg|woff|woff2|eot|ttf)$/,
use: [{
loader: 'url-loader',
options: {
limit: 50_000,
},
}],
}];
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.
module.exports = {
node: {
path: 'empty',
},
};
module.exports = {
resolve: {
fallback: {
path: false,
},
},
};
Fixes webpack comilation error:
[DEP_WEBPACK_EXTERNALS_FUNCTION_PARAMETERS] DeprecationWarning: The externals-function should be defined like ({context, request}, cb) => { ... }
Checkout in 🐊Putout Editor.
module.exports = {
externals: [externals],
};
function externals(context, request, callback) {}
module.exports = {
externals: [externals],
};
function externals({context, request}, callback) {}
MIT