Skip to content

Commit

Permalink
Support turn off NodeSourcePlugin with false option
Browse files Browse the repository at this point in the history
  • Loading branch information
jchip committed Jun 3, 2017
1 parent 1a5858a commit 8fec262
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 45 deletions.
2 changes: 2 additions & 0 deletions lib/node/NodeSourcePlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module.exports = class NodeSourcePlugin {
}
apply(compiler) {
const options = this.options;
if(options === false) // allow single kill switch to turn off this plugin
return;

function getPathToModule(module, type) {
if(type === true || (type === undefined && nodeLibsBrowser[module])) {
Expand Down
99 changes: 54 additions & 45 deletions schemas/webpackOptionsSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -808,55 +808,64 @@
},
"node": {
"description": "Include polyfills or mocks for various node stuff.",
"additionalProperties": {
"enum": [
false,
true,
"mock",
"empty"
]
},
"properties": {
"Buffer": {
"enum": [
false,
true,
"mock"
]
},
"__dirname": {
"enum": [
false,
true,
"mock"
]
},
"__filename": {
"enum": [
false,
true,
"mock"
]
},
"console": {
"anyOf": [
{
"enum": [
false,
true,
"mock"
false
]
},
"global": {
"type": "boolean"
},
"process": {
"enum": [
false,
true,
"mock"
]
{
"additionalProperties": {
"enum": [
false,
true,
"mock",
"empty"
]
},
"properties": {
"Buffer": {
"enum": [
false,
true,
"mock"
]
},
"__dirname": {
"enum": [
false,
true,
"mock"
]
},
"__filename": {
"enum": [
false,
true,
"mock"
]
},
"console": {
"enum": [
false,
true,
"mock"
]
},
"global": {
"type": "boolean"
},
"process": {
"enum": [
false,
true,
"mock"
]
}
},
"type": "object"
}
},
"type": "object"
]
},
"output": {
"$ref": "#/definitions/output"
Expand Down

0 comments on commit 8fec262

Please sign in to comment.