diff --git a/apps/remix-ide/src/app.js b/apps/remix-ide/src/app.js index 4cc24857b4..adc952d27f 100644 --- a/apps/remix-ide/src/app.js +++ b/apps/remix-ide/src/app.js @@ -78,7 +78,7 @@ class AppComponent { constructor() { console.log(window.electronAPI) - console.log(window) + console.log(window.api) this.appManager = new RemixAppManager({}) this.queryParams = new QueryParams() diff --git a/apps/remix-ide/src/index.tsx b/apps/remix-ide/src/index.tsx index 4bc938792f..37bee1f5aa 100644 --- a/apps/remix-ide/src/index.tsx +++ b/apps/remix-ide/src/index.tsx @@ -16,14 +16,14 @@ import { Storage } from '@remix-project/remix-lib' } catch (e) { } const theme = new ThemeModule() theme.initTheme() - /* + render( , document.getElementById('root') ) - */ + })() diff --git a/apps/remixdesktop/webpack.config.js b/apps/remixdesktop/webpack.config.js index a30a1f1dcd..9f2003b34d 100644 --- a/apps/remixdesktop/webpack.config.js +++ b/apps/remixdesktop/webpack.config.js @@ -4,11 +4,15 @@ const TerserPlugin = require("terser-webpack-plugin") const CssMinimizerPlugin = require("css-minimizer-webpack-plugin") // Nx plugins for webpack. -module.exports = composePlugins((config) => { - config = {} +module.exports = composePlugins((input) => { + + const config = { + mode: input.mode === 'production' ? 'production' : 'development', + } + config.target = 'electron-main' config.devtool = 'source-map' - config.mode = 'production' + config.output = { path: __dirname + '/.webpack/main', filename: '[name].js', @@ -20,11 +24,14 @@ module.exports = composePlugins((config) => { index: ['./apps/remixdesktop/src/index.ts'], preload: ['./apps/remixdesktop/src/preload.ts'], } - + + + const mainEntry = config.mode === 'production'? `\`file://$\{require('path').resolve(__dirname, '..', 'renderer', 'index.html')}\``: `'http://localhost:8080'` + config.plugins= [ new webpack.DefinePlugin({ - MAIN_WINDOW_WEBPACK_ENTRY:`\`file://$\{require('path').resolve(__dirname, '..', 'renderer', 'index.html')}\``, - 'process.env.MAIN_WINDOW_WEBPACK_ENTRY': `\`file://$\{require('path').resolve(__dirname, '..', 'renderer', 'index.html')}\``, + MAIN_WINDOW_WEBPACK_ENTRY: mainEntry, + 'process.env.MAIN_WINDOW_WEBPACK_ENTRY': mainEntry, MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY: `\`$\{require('path').resolve(__dirname, 'preload.js')}\``, 'process.env.MAIN_WINDOW_PRELOAD_WEBPACK_ENTRY': `\`$\{require('path').resolve(__dirname, '..', 'render', 'preload.js')}\``, }) diff --git a/package.json b/package.json index 2ec3c52e75..991e849ccd 100644 --- a/package.json +++ b/package.json @@ -55,7 +55,7 @@ "build:e2e": "node apps/remix-ide-e2e/src/buildGroupTests.js && tsc -p apps/remix-ide-e2e/tsconfig.e2e.json", "serve:desktop:dist": "rm -rf apps/remixdesktop/.webpack && yarn nx build remixdesktop && NX_DESKTOP_FROM_DIST=true nx build remix-ide --configuration=desktop && cp -r dist/apps/remix-ide apps/remixdesktop/.webpack/renderer && yarn electron apps/remixdesktop/.webpack/main", "build:desktop": "rm -rf apps/remixdesktop/.webpack && yarn nx build remixdesktop && NX_DESKTOP_FROM_DIST=true nx build remix-ide --configuration=desktop && cp -r dist/apps/remix-ide apps/remixdesktop/.webpack/renderer && cd apps/remixdesktop/ && yarn package", - "serve:desktop:webpack": "rm -rf apps/remixdesktop/.webpack && yarn nx build remixdesktop && yarn serve && yarn electron apps/remixdesktop", + "serve:desktop": "rm -rf apps/remixdesktop/.webpack && yarn nx build remixdesktop --configuration=development && yarn electron apps/remixdesktop", "babel": "babel", "watch:e2e": "nodemon", "bumpVersion:libs": "gulp & gulp syncLibVersions;",