UNPKG

505 BJavaScriptView Raw
1const path = require("path");
2const fs = require("fs-extra");
3
4module.exports = function () {
5 fs.copySync(this.resourcePath, path.resolve(this._compiler.options.output.path, path.relative(process.cwd(), this.resourcePath)));
6 return `
7try {
8 global.process.dlopen(module, './${path.relative(process.cwd(), this.resourcePath).replace(/\\/g, "/")}');
9} catch(e) {
10 throw new Error('Cannot open ./${path.relative(process.cwd(), this.resourcePath).replace(/\\/g, "/")}: ' + e);
11}`.trim();
12};