webpack-node-externals
Advanced tools
Comparing version 2.4.0 to 2.5.0
16
index.js
@@ -29,2 +29,7 @@ var utils = require('./utils'); | ||
mistakes.forEach(function (mistake) { | ||
utils.error( | ||
mistakes.map(function (mistake) { | ||
return mistake.message; | ||
}) | ||
); | ||
utils.log(mistake.message); | ||
@@ -57,3 +62,12 @@ }); | ||
// return an externals function | ||
return function (context, request, callback) { | ||
return function (arg1, arg2, arg3) { | ||
var context = arg1; | ||
var request = arg2; | ||
var callback = arg3; | ||
// in case of webpack 5 | ||
if (arg1 && arg1.context && arg1.request) { | ||
context = arg1.context; | ||
request = arg1.request; | ||
callback = arg2; | ||
} | ||
var moduleName = getModuleName(request, includeAbsolutePaths); | ||
@@ -60,0 +74,0 @@ if ( |
{ | ||
"name": "webpack-node-externals", | ||
"version": "2.4.0", | ||
"version": "2.5.0", | ||
"description": "Easily exclude node_modules in Webpack bundle", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
20
utils.js
@@ -105,5 +105,5 @@ var fs = require('fs'); | ||
importType: ['import', 'importype', 'importtype'], | ||
modulesDir: ['moduleDir', 'moduledir', 'moduledirs'], | ||
modulesDir: ['moduledir', 'moduledirs'], | ||
modulesFromFile: ['modulesfile'], | ||
includeAbsolutePaths: ['includeAbsolutePaths'], | ||
includeAbsolutePaths: ['includeAbsolutesPaths'], | ||
additionalModuleDirs: ['additionalModulesDirs', 'additionalModulesDir'], | ||
@@ -134,4 +134,14 @@ }; | ||
exports.log = function(message) { | ||
console.log(`[webpack-node-externals] : ${message}`) | ||
} | ||
exports.log = function (message) { | ||
console.log(`[webpack-node-externals] : ${message}`); | ||
}; | ||
exports.error = function (errors) { | ||
throw new Error( | ||
errors | ||
.map(function (error) { | ||
return `[webpack-node-externals] : ${error}`; | ||
}) | ||
.join('\r\n') | ||
); | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15952
214