node-clipboard-event
node-clipboard-event copied to clipboard
clipboard-event dont work with pkg?
I dont know why , but when i open my file try.js:
const clipboardListener = require('clipboard-event');
clipboardListener.startListening();
clipboardListener.on('change', () => {
console.log('Clipboard changed');
}
with "node try.js" work good, but...
when i use "pkg try.js --target node14-win-x64" and open the file try.exe (the same file this literally) just close whiout show error. Am I the only one that this happens to? or is it a bug in this package?
Ok y found a solution for this... but i dont know if that is the better way to do that, so... here is
i change:
const clipboardListener = require('clipboard-event');
to:
const path = require('path');
const clipboardy = require(path.join(process.cwd(), '/node_modules/clipboardy'));
and this works fine but, when i use pkg i get a warning message saying:
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a string literal as an argument for 'require', or leave it
as is and specify the resolved file name in 'scripts' option.
I understand this problem occurs because the dependency uses a binary file, what would be the best way to use a dependency of this style?