-
Notifications
You must be signed in to change notification settings - Fork 307
Open
Description
I use webpack to create a bundle, vm2 is one dependency. webpack can work well with following config:
ignoreWarnings: [
{
message: /Can't resolve 'coffee-script'/,
},
]
module: {
parser: {
javascript: {
commonjsMagicComments: true
}
}
}
when I run the project I encountered:
Error: ENOENT: no such file or directory, open 'xx/dist/bridge.js'
I think it is because below:
vm2/lib/vm.js
const bridgeScript = compileScript(`${__dirname}/bridge.js`,
`(function(global) {"use strict"; const exports = {};${fs.readFileSync(`${__dirname}/bridge.js`, 'utf8')}\nreturn exports;})`);
const setupSandboxScript = compileScript(`${__dirname}/setup-sandbox.js`,
`(function(global, host, bridge, data, context) { ${fs.readFileSync(`${__dirname}/setup-sandbox.js`, 'utf8')}\n})`);
vm2/lib/nodevm.js
if (!cacheSandboxScript) {
cacheSandboxScript = compileScript(`${__dirname}/setup-node-sandbox.js`,
`(function (host, data) { ${fs.readFileSync(`${__dirname}/setup-node-sandbox.js`, 'utf8')}\n})`);
}
vm2/lib/nodevm.js
if (!cacheEventsScript) {
const eventsSource = fs.readFileSync(`${__dirname}/events.js`, 'utf8');
cacheEventsScript = new VMScript(`(function (fromhost) { const module = {}; module.exports={};{ ${eventsSource}
} return module.exports;})`, {filename: 'events.js'});
}
I have to copy these files to dist. Any suggestions or workaround?
Thanks
karlhorky and lukaselmer
Metadata
Metadata
Assignees
Labels
No labels