mirror of
https://github.com/balena-io/etcher.git
synced 2025-04-25 07:47:18 +00:00
Fix windows ia32 rebuild
Change-type: patch
This commit is contained in:
parent
5f5c66e3f2
commit
f0bbd1a1cd
@ -1,17 +1,26 @@
|
||||
'use strict'
|
||||
|
||||
const cp = require('child_process')
|
||||
const cp = require('child_process');
|
||||
const rimraf = require('rimraf');
|
||||
const process = require('process');
|
||||
|
||||
// Rebuild native modules for ia32 and run webpack again for the ia32 part of windows packages
|
||||
exports.default = function(context) {
|
||||
if (context.platform.name === 'windows') {
|
||||
cp.execFileSync(
|
||||
'bash',
|
||||
['./node_modules/.bin/electron-rebuild', '--types', 'dev', '--arch', context.arch]
|
||||
['./node_modules/.bin/electron-rebuild', '--types', 'dev', '--arch', context.arch],
|
||||
);
|
||||
rimraf.sync('generated');
|
||||
cp.execFileSync(
|
||||
'bash',
|
||||
['./node_modules/.bin/webpack']
|
||||
['./node_modules/.bin/webpack'],
|
||||
{
|
||||
env: {
|
||||
...process.env,
|
||||
npm_config_target_arch: context.arch,
|
||||
},
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ import * as MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||
import * as os from 'os';
|
||||
import outdent from 'outdent';
|
||||
import * as path from 'path';
|
||||
import { env } from 'process';
|
||||
import * as SimpleProgressWebpackPlugin from 'simple-progress-webpack-plugin';
|
||||
import * as TerserPlugin from 'terser-webpack-plugin';
|
||||
import { BannerPlugin, NormalModuleReplacementPlugin } from 'webpack';
|
||||
@ -77,7 +78,11 @@ function renameNodeModules(resourcePath: string) {
|
||||
|
||||
function findLzmaNativeBindingsFolder(): string {
|
||||
const files = readdirSync(path.join('node_modules', 'lzma-native'));
|
||||
const bindingsFolder = files.find((f) => f.startsWith('binding-'));
|
||||
const bindingsFolder = files.find(
|
||||
(f) =>
|
||||
f.startsWith('binding-') &&
|
||||
f.endsWith(env.npm_config_target_arch || os.arch()),
|
||||
);
|
||||
if (bindingsFolder === undefined) {
|
||||
throw new Error('Could not find lzma_native binding');
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user