pluginOptions.electronBuilder.externals doesn't work as expected
Closed this issue · 4 comments
because of module node-bindings
's limitation, module ffi
and ref
must not be packed ( or must be used as externals ) by webpack, otherwise it will failed with error Could not load the bindings file
, so i configured as this comment suggested.
my vue.config.js:
const { resolve } = require('path');
module.exports = {
configureWebpack: config => {
config.devtool = 'source-map';
config.optimization.minimizer[0].options.terserOptions.keep_classnames = true;
config.optimization.minimizer[0].options.terserOptions.keep_fnames = true;
config.optimization.minimizer[0].options.terserOptions.compress.drop_debugger = true;
config.externals['ffi'] = "require('ffi')";
config.externals['ref'] = "require('ref')";
},
pluginOptions: {
electronBuilder: {
chainWebpackMainProcess: config => {
},
externals: ['ffi', 'ref', 'shortcut-capture', 'winston', 'winston-daily-rotate-file'],
builderOptions: {
extraFiles: ['lib'],
extraResources: ['workbench-v*.asar', 'preloads'],
},
},
},
};
but these two lines are mandatory to make ffi
and ref
work even when i have already configured pluginOptions.electronBuilder.externals.
config.externals['ffi'] = "require('ffi')";
config.externals['ref'] = "require('ref')";
thi is not like what you said in this comment
To Reproduce
none
Expected behavior
no need to configure
config.externals['ffi'] = "require('ffi')";
config.externals['ref'] = "require('ref')";
when i have configured pluginOptions.electronBuilder.externals
Environment (please complete the following information):
- OS and version: CentOS 7.4 64bit
- node version: 12.4.0
- npm version: not used
- yarn version (if used): 1.19.0
- vue-cli-plugin-electron-builder version : 1.4.3
- electron version: 6.1.4
- other vue plugins used:
- custom config for vcp-electron-builder:
- (if possible) link to your repo:
i am want use win32-api
as same question
win32-api
is use node-bindings
,I also add
pluginOptions: {
webpackBundleAnalyzer: {
openAnalyzer: false
},
electronBuilder: {
externals: ['win32-api','bindings'],
nodeModulesPath: ['../../node_modules', './node_modules']
}
}
Try this:
config.externals(['ffi', 'ref']);
You should see https://github.com/neutrinojs/webpack-chain .
@bruceauyeung can you try again with the latest version of this plugin (preferably the 2.0 beta)? I tried to reproduce your issue and it worked fine, all I had to do was set the externals
array. I think I remember being able to reproduce your error a while ago, and I think I may have fixed it accidently.
This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.