-
Notifications
You must be signed in to change notification settings - Fork 333
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: node-loader that ignores public path (#9537)
Signed-off-by: Matt Krick <[email protected]>
- Loading branch information
Showing
4 changed files
with
70 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
"use strict"; | ||
|
||
const loader = require("./index"); | ||
|
||
module.exports = loader.default; | ||
module.exports.raw = loader.raw; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"use strict"; | ||
|
||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports.default = loader; | ||
exports.raw = void 0; | ||
|
||
var _loaderUtils = require("loader-utils"); | ||
|
||
var _options = _interopRequireDefault(require("./options.json")); | ||
|
||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
|
||
/* | ||
MIT License http://www.opensource.org/licenses/mit-license.php | ||
Author Tobias Koppers @sokra | ||
*/ | ||
function loader(content) { | ||
const options = this.getOptions(_options.default); | ||
const name = (0, _loaderUtils.interpolateName)(this, typeof options.name !== "undefined" ? options.name : "[contenthash].[ext]", { | ||
context: this.rootContext, | ||
content | ||
}); | ||
this.emitFile(name, content); | ||
return ` | ||
try { | ||
process.dlopen(module, __dirname + require("path").sep + ${JSON.stringify(name)}${typeof options.flags !== "undefined" ? `, ${JSON.stringify(options.flags)}` : ""}); | ||
} catch (error) { | ||
throw new Error('node-loader:\\n' + error); | ||
} | ||
`; | ||
} | ||
|
||
const raw = true; | ||
exports.raw = raw; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"title": "Node Loader options", | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"anyOf": [ | ||
{ | ||
"type": "string" | ||
}, | ||
{ | ||
"instanceof": "Function" | ||
} | ||
] | ||
}, | ||
"flags": { | ||
"type": "integer" | ||
} | ||
}, | ||
"additionalProperties": false | ||
} |