File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ module.exports = class NodeSourcePlugin {
1313 }
1414 apply ( compiler ) {
1515 const options = this . options ;
16+ if ( options === false ) // allow single kill switch to turn off this plugin
17+ return ;
1618
1719 function getPathToModule ( module , type ) {
1820 if ( type === true || ( type === undefined && nodeLibsBrowser [ module ] ) ) {
Original file line number Diff line number Diff line change 811811 },
812812 "node" : {
813813 "description" : " Include polyfills or mocks for various node stuff." ,
814- "additionalProperties" : {
815- "enum" : [
816- false ,
817- true ,
818- " mock" ,
819- " empty"
820- ]
821- },
822- "properties" : {
823- "Buffer" : {
824- "enum" : [
825- false ,
826- true ,
827- " mock"
828- ]
829- },
830- "__dirname" : {
831- "enum" : [
832- false ,
833- true ,
834- " mock"
835- ]
836- },
837- "__filename" : {
838- "enum" : [
839- false ,
840- true ,
841- " mock"
842- ]
843- },
844- "console" : {
814+ "anyOf" : [
815+ {
845816 "enum" : [
846- false ,
847- true ,
848- " mock"
817+ false
849818 ]
850819 },
851- "global" : {
852- "type" : " boolean"
853- },
854- "process" : {
855- "enum" : [
856- false ,
857- true ,
858- " mock"
859- ]
820+ {
821+ "additionalProperties" : {
822+ "enum" : [
823+ false ,
824+ true ,
825+ " mock" ,
826+ " empty"
827+ ]
828+ },
829+ "properties" : {
830+ "Buffer" : {
831+ "enum" : [
832+ false ,
833+ true ,
834+ " mock"
835+ ]
836+ },
837+ "__dirname" : {
838+ "enum" : [
839+ false ,
840+ true ,
841+ " mock"
842+ ]
843+ },
844+ "__filename" : {
845+ "enum" : [
846+ false ,
847+ true ,
848+ " mock"
849+ ]
850+ },
851+ "console" : {
852+ "enum" : [
853+ false ,
854+ true ,
855+ " mock"
856+ ]
857+ },
858+ "global" : {
859+ "type" : " boolean"
860+ },
861+ "process" : {
862+ "enum" : [
863+ false ,
864+ true ,
865+ " mock"
866+ ]
867+ }
868+ },
869+ "type" : " object"
860870 }
861- },
862- "type" : " object"
871+ ]
863872 },
864873 "output" : {
865874 "$ref" : " #/definitions/output"
Original file line number Diff line number Diff line change 1+ require ( "should" ) ;
2+
3+ it ( "should not load node-libs-browser when node option is false" , function ( ) {
4+ ( typeof process ) . should . be . eql ( "undefined" ) ;
5+ } ) ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ target : "web" ,
3+ node : false
4+ } ;
Original file line number Diff line number Diff line change 1+ require ( "should" ) ;
2+
3+ it ( "should add node-libs-browser to target web by default" , function ( ) {
4+ process . browser . should . be . eql ( true ) ;
5+ } ) ;
Original file line number Diff line number Diff line change 1+ module . exports = {
2+ target : "web" ,
3+ node : {
4+ process : true
5+ }
6+ } ;
You can’t perform that action at this time.
0 commit comments