|
|
před 1 rokem | |
|---|---|---|
| .. | ||
| node_modules | před 1 rokem | |
| index.d.ts | před 1 rokem | |
| index.js | před 1 rokem | |
| license | před 1 rokem | |
| package.json | před 1 rokem | |
| readme.md | před 1 rokem | |
Polyfill Node.js core modules in Webpack.
This module is only needed for Webpack 5+.
npm install node-polyfill-webpack-plugin
Add the following to your webpack.config.js:
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
// Other rules...
plugins: [
new NodePolyfillPlugin()
]
};
Type: object
excludeAliases and includeAliases are mutually exclusive.
By default, the modules that were polyfilled in Webpack 4 are mirrored over. However, if you don't want a module like console to be polyfilled you can specify alises to be skipped here.
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
// Other rules...
plugins: [
new NodePolyfillPlugin({
excludeAliases: ['console']
})
]
};
Alternatively, you can choose to only include certain aliases. For example, you can only have console polyfilled.
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
module.exports = {
// Other rules...
plugins: [
new NodePolyfillPlugin({
includeAliases: ['console']
})
]
};
Bufferconsoleprocessassertbufferconsoleconstantscryptodomaineventshttphttpsospathpunycodeprocessquerystringstream_stream_duplex_stream_passthrough_stream_readable_stream_transform_stream_writablestring_decodersystimersttyurlutilvmzlib