mirror of
https://github.com/scratchfoundation/scratch-desktop.git
synced 2024-12-22 21:52:31 -05:00
Autodetect electron version for @babel/preset-env
This commit is contained in:
parent
530857a99b
commit
05bc41389f
1 changed files with 7 additions and 1 deletions
|
@ -1,8 +1,14 @@
|
||||||
|
const childProcess = require('child_process');
|
||||||
|
|
||||||
|
const electronPath = require('electron');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
|
||||||
|
|
||||||
const isProduction = (process.env.NODE_ENV === 'production');
|
const isProduction = (process.env.NODE_ENV === 'production');
|
||||||
|
|
||||||
|
const electronVersion = childProcess.execSync(`${electronPath} --version`, {encoding: 'utf8'}).trim();
|
||||||
|
console.log(`Targeting Electron ${electronVersion}`);
|
||||||
|
|
||||||
const makeConfig = function (options) {
|
const makeConfig = function (options) {
|
||||||
// eslint-disable-next-line no-console
|
// eslint-disable-next-line no-console
|
||||||
console.log(`Module "${options.name}" building in production mode? ${isProduction}`);
|
console.log(`Module "${options.name}" building in production mode? ${isProduction}`);
|
||||||
|
@ -16,7 +22,7 @@ const makeConfig = function (options) {
|
||||||
'@babel/plugin-proposal-object-rest-spread'
|
'@babel/plugin-proposal-object-rest-spread'
|
||||||
],
|
],
|
||||||
presets: [
|
presets: [
|
||||||
['@babel/preset-env', {targets: {electron: '3.0.13'}}]
|
['@babel/preset-env', {targets: {electron: electronVersion}}]
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue