Skip to content

Commit

Permalink
Merge pull request #7406 from ever-co/fix/blank-screen
Browse files Browse the repository at this point in the history
Fix/blank screen
  • Loading branch information
evereq authored Dec 28, 2023
2 parents 3aa2c7c + 6c125a9 commit 3d2334d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 46 deletions.
40 changes: 12 additions & 28 deletions apps/desktop-timer/config/custom-webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const webpack = require('webpack');
require('webpack');
//Polyfill Node.js core modules in Webpack. This module is only needed for webpack 5+.
const TerserPlugin = require('terser-webpack-plugin');
//Polyfill Node.js core modules in Webpack. This module is only needed for webpack 5+.
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');

console.log('Using custom Webpack config...');

Expand All @@ -15,6 +17,7 @@ if (isCircleEnv) {
}

module.exports = {
target: 'electron-renderer',
resolve: {
mainFields: ['es2016', 'browser', 'module', 'main']
},
Expand All @@ -34,33 +37,14 @@ module.exports = {
]
},
externals: {
'electron-log': 'electron-log',
'electron-log': 'electron-log'
},
plugins: [
// main process
new webpack.DefinePlugin({
'process.type': '"browser"'
}),

// renderer process
new webpack.DefinePlugin({
'process.type': '"renderer"'
}),
]
new NodePolyfillPlugin({
excludeAliases: ['console']
})
],
output: {
globalObject: 'globalThis'
}
};

/* NOTE: below code can be used to fix some more things, see https://github.com/maximegris/angular-electron/blob/master/angular.webpack.js#L10
if (options.fileReplacements) {
for(let fileReplacement of options.fileReplacements) {
if (fileReplacement.replace !== 'apps/server/src/environments/environment.ts' && fileReplacement.replace !== 'apps/gauzy/src/environments/environment.ts') {
continue;
}
let fileReplacementParts = fileReplacement['with'].split('.');
if (fileReplacementParts.length > 1 && ['web'].indexOf(fileReplacementParts[1]) >= 0) {
config.target = 'web';
}
break;
}
}
*/
30 changes: 13 additions & 17 deletions apps/desktop/config/custom-webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
require('webpack');
//Polyfill Node.js core modules in Webpack. This module is only needed for webpack 5+.
const TerserPlugin = require('terser-webpack-plugin');
//Polyfill Node.js core modules in Webpack. This module is only needed for webpack 5+.
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');

console.log('Using custom Webpack config...');

Expand All @@ -14,6 +17,7 @@ if (isCircleEnv) {
}

module.exports = {
target: 'electron-renderer',
resolve: {
mainFields: ['es2016', 'browser', 'module', 'main']
},
Expand All @@ -33,22 +37,14 @@ module.exports = {
]
},
externals: {
'electron-log': 'electron-log',
'electron-log': 'electron-log'
},
plugins: [
new NodePolyfillPlugin({
excludeAliases: ['console']
})
],
output: {
globalObject: 'globalThis'
}
};

/* NOTE: below code can be used to fix some more things, see https://github.com/maximegris/angular-electron/blob/master/angular.webpack.js#L10
if (options.fileReplacements) {
for(let fileReplacement of options.fileReplacements) {
if (fileReplacement.replace !== 'apps/server/src/environments/environment.ts' && fileReplacement.replace !== 'apps/gauzy/src/environments/environment.ts') {
continue;
}
let fileReplacementParts = fileReplacement['with'].split('.');
if (fileReplacementParts.length > 1 && ['web'].indexOf(fileReplacementParts[1]) >= 0) {
config.target = 'web';
}
break;
}
}
*/
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
"@semantic-release/npm": "^7.1.1",
"@types/jest": "^29.4.4",
"@types/jsdom": "^21.1.6",
"@types/webpack": "^5.28.5",
"@types/yargs": "^15.0.9",
"ajv-formats": "^2.1.1",
"cloc": "^2.7.0",
Expand Down
11 changes: 10 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11313,6 +11313,15 @@
resolved "https://registry.yarnpkg.com/@types/webidl-conversions/-/webidl-conversions-7.0.3.tgz#1306dbfa53768bcbcfc95a1c8cde367975581859"
integrity sha512-CiJJvcRtIgzadHCYXw7dqEnMNRjhGZlYK05Mj9OyktqV8uVT8fD2BFOB7S1uwBE3Kj2Z+4UyPmFw/Ixgw/LAlA==

"@types/webpack@^5.28.5":
version "5.28.5"
resolved "https://registry.yarnpkg.com/@types/webpack/-/webpack-5.28.5.tgz#0e9d9a15efa09bbda2cef41356ca4ac2031ea9a2"
integrity sha512-wR87cgvxj3p6D0Crt1r5avwqffqPXUkNlnQ1mjU93G7gCuFjufZR4I6j8cz5g1F1tTYpfOOFvly+cmIQwL9wvw==
dependencies:
"@types/node" "*"
tapable "^2.2.0"
webpack "^5"

"@types/whatwg-url@^8.2.1":
version "8.2.2"
resolved "https://registry.yarnpkg.com/@types/whatwg-url/-/whatwg-url-8.2.2.tgz#749d5b3873e845897ada99be4448041d4cc39e63"
Expand Down Expand Up @@ -37616,7 +37625,7 @@ [email protected]:
watchpack "^2.4.0"
webpack-sources "^3.2.3"

[email protected], webpack@^5.58.1, webpack@^5.65.0, webpack@^5.75.0:
[email protected], webpack@^5, webpack@^5.58.1, webpack@^5.65.0, webpack@^5.75.0:
version "5.89.0"
resolved "https://registry.yarnpkg.com/webpack/-/webpack-5.89.0.tgz#56b8bf9a34356e93a6625770006490bf3a7f32dc"
integrity sha512-qyfIC10pOr70V+jkmud8tMfajraGCZMBWJtrmuBymQKCrLTRejBI8STDp1MCyZu/QTdZSeacCQYpYNQVOzX5kw==
Expand Down

0 comments on commit 3d2334d

Please sign in to comment.