2013-02-14 00:00:07 +08:00
|
|
|
/*
|
|
|
|
MIT License http://www.opensource.org/licenses/mit-license.php
|
|
|
|
Author Tobias Koppers @sokra
|
|
|
|
*/
|
2017-01-11 20:09:19 +08:00
|
|
|
"use strict";
|
2013-02-14 00:00:07 +08:00
|
|
|
|
2017-01-11 20:09:19 +08:00
|
|
|
const ExternalsPlugin = require("../ExternalsPlugin");
|
|
|
|
|
2018-02-25 09:00:20 +08:00
|
|
|
const builtins =
|
2018-11-02 18:04:02 +08:00
|
|
|
// eslint-disable-next-line node/no-unsupported-features/node-builtins,node/no-deprecated-api
|
2018-02-25 09:00:20 +08:00
|
|
|
require("module").builtinModules || Object.keys(process.binding("natives"));
|
2018-01-28 05:05:15 +08:00
|
|
|
|
2017-01-11 20:09:19 +08:00
|
|
|
class NodeTargetPlugin {
|
|
|
|
apply(compiler) {
|
2018-01-28 05:05:15 +08:00
|
|
|
new ExternalsPlugin("commonjs", builtins).apply(compiler);
|
2017-01-11 20:09:19 +08:00
|
|
|
}
|
|
|
|
}
|
2014-03-06 02:56:53 +08:00
|
|
|
|
2013-02-14 00:00:07 +08:00
|
|
|
module.exports = NodeTargetPlugin;
|