Electron更新包减肥

\resources\app\node_modules\electron-edge-js\lib\native\win32文件夹下的ia32文件夹整个删除,X64下的文件夹除13.0外全部删除,外部几个dll文件也全删除,最只目录如下图所示

然后修改install.js文件

 删除其中所有和ia32相关的内容,最终的文件如下

var fs = require('fs')
	, path = require('path')
	, spawn = require('child_process').spawn
	, whereis = require('./whereis');

if (process.platform === 'win32') {
	var dotnetPath = whereis('dotnet', 'dotnet.exe');
	if (dotnetPath) {
		spawn(dotnetPath, ['restore'], { stdio: 'inherit', cwd: path.resolve(__dirname, '..', 'lib', 'bootstrap') })
			.on('close', function() {
				spawn(dotnetPath, ['build', '--configuration', 'Release'], { stdio: 'inherit', cwd: path.resolve(__dirname, '..', 'lib', 'bootstrap') })
					.on('close', function() {
						require('./checkplatform');
					});
			});
	}

	else {
		require('./checkplatform');
	}
} 

else {
	if (process.platform === 'darwin') {

		// Code from electron-prebuild: https://github.com/electron/electron-rebuild
		const possibleModuleNames = ['electron', 'electron-prebuilt', 'electron-prebuilt-compile'];

		function locateElectronPrebuilt () {
			let electronPath;

			// Attempt to locate modules by path
			let foundModule = possibleModuleNames.some((moduleName) => {
				electronPath = path.join(__dirname, '..', '..', moduleName);
				return fs.existsSync(electronPath);
			});

			// Return a path if we found one
			if (foundModule) return electronPath;

			// Attempt to locate modules by require
			foundModule = possibleModuleNames.some((moduleName) => {
				try {
				electronPath = path.join(require.resolve(moduleName), '..');
				} catch (e) {
				return false;
				}
				return fs.existsSync(electronPath);
			});

			// Return a path if we found one
			if (foundModule) return electronPath;
			return null;
		}

		location = locateElectronPrebuilt();
		version = null;
		electronPath = null;
		if (location != null)
		{ 
			// NB: We assume here that electron-prebuilt is a sibling package of ours
			pkg = null;
			try {
				let pkgJson = path.join(location, 'package.json');

				pkg = require(pkgJson);

				version = pkg.version;
			} catch (e) {
				console.error("Unable to find electron-prebuilt's version number, either install it or specify an explicit version");
			}
		}
		if (version !== null)
		{
			spawn('node-gyp', ['configure', 'build', '--target='+version, '--disturl=https://atom.io/download/atom-shell'], { stdio: 'inherit' });
		}
		else
			spawn('node-gyp', ['configure', 'build'], { stdio: 'inherit' });
   		
	}
	else {
		spawn('node-gyp', ['configure', 'build'], { stdio: 'inherit' });
	}
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值