Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hearmeneigh committed Jul 7, 2024
1 parent 726401a commit 4aa4a5e
Show file tree
Hide file tree
Showing 9 changed files with 223 additions and 204 deletions.
1 change: 0 additions & 1 deletion electron/blocker/blocker.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import log from 'electron-log';
import { ElectronBlocker } from '@cliqz/adblocker-electron';
import fetch from 'node-fetch';
import path from 'path';
import fs from 'fs';
import * as _ from 'lodash';
Expand Down
1 change: 0 additions & 1 deletion electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import DownloadItem = electron.DownloadItem;
import { AdCoordinatorHost } from '../chat/ads/ad-coordinator-host';
import { IpcMainEvent } from 'electron';
import { BlockerIntegration } from './blocker/blocker';
import core from "../chat/core";

//tslint:disable-next-line:no-require-imports
const pck = require('./package.json');
Expand Down
4 changes: 3 additions & 1 deletion electron/tsconfig-main.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
"esModuleInterop": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true
},
"include": ["main.ts"]
}
4 changes: 3 additions & 1 deletion electron/tsconfig-renderer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@
"noUnusedLocals": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
"esModuleInterop": true,
"skipDefaultLibCheck": true,
"skipLibCheck": true
},
"include": ["chat.ts", "window.ts", "../**/*.d.ts"]
}
26 changes: 16 additions & 10 deletions electron/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const mainConfig = {
transpileOnly: true
}
},
{test: path.join(__dirname, 'package.json'), loader: 'file-loader', options: {name: 'package.json'}, type: 'javascript/auto'},
{test: path.join(__dirname, 'package.json'), loader: 'json-loader', options: {name: 'package.json'}, type: 'javascript/auto'},
{test: /\.(png|ico|html)$/, loader: 'file-loader', options: {name: '[name].[ext]'}},
{test: /\.raw\.js$/, loader: 'raw-loader'}
]
Expand All @@ -38,7 +38,8 @@ const mainConfig = {
new ForkTsCheckerWebpackPlugin({
async: false,
tslint: path.join(__dirname, '../tslint.json'),
tsconfig: './tsconfig-main.json'
tsconfig: './tsconfig-main.json',
ignoreLintWarnings: true,
})
],
resolve: {
Expand Down Expand Up @@ -90,7 +91,7 @@ const mainConfig = {
use: [
'vue-style-loader',
{loader: 'css-loader', options: {esModule: false}},
'sass-loader'
{loader: 'sass-loader', options: {warnRuleAsWarning: false}},
]
},
{
Expand All @@ -113,7 +114,8 @@ const mainConfig = {
async: false,
tslint: path.join(__dirname, '../tslint.json'),
tsconfig: './tsconfig-renderer.json',
vue: true
vue: true,
ignoreLintWarnings: true,
}),
new VueLoaderPlugin(),
new CopyPlugin(
Expand Down Expand Up @@ -189,7 +191,8 @@ const storeWorkerEndpointConfig = _.assign(
async: false,
tslint: path.join(__dirname, '../tslint.json'),
tsconfig: './tsconfig-renderer.json',
vue: true
vue: true,
ignoreLintWarnings: true,
})
]
}
Expand All @@ -211,7 +214,7 @@ module.exports = function(mode) {
{loader: 'file-loader', options: {name: 'themes/[name].css'}},
'extract-loader',
{loader: 'css-loader', options: {esModule: false}},
'sass-loader'
{loader: 'sass-loader', options: {warnRuleAsWarning: false}},
]
}
);
Expand All @@ -227,16 +230,19 @@ module.exports = function(mode) {
{loader: 'file-loader', options: {name: 'fa.css'}},
'extract-loader',
{loader: 'css-loader', options: {esModule: false}},
'sass-loader'
{loader: 'sass-loader', options: {warnRuleAsWarning: false}},
]
}
);

if(mode === 'production') {
process.env.NODE_ENV = 'production';
mainConfig.devtool = rendererConfig.devtool = 'source-map';

mainConfig.devtool = 'inline-source-map';
rendererConfig.devtool = 'inline-source-map';
storeWorkerEndpointConfig.devtool = 'inline-source-map';

rendererConfig.plugins.push(new OptimizeCssAssetsPlugin());
storeWorkerEndpointConfig.devtool = 'source-map';
} else {
// mainConfig.devtool = rendererConfig.devtool = 'none';

Expand All @@ -245,5 +251,5 @@ module.exports = function(mode) {
storeWorkerEndpointConfig.devtool = 'inline-source-map';
}

return [mainConfig, rendererConfig, storeWorkerEndpointConfig];
return [storeWorkerEndpointConfig, mainConfig, rendererConfig];
};
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"@types/bluebird": "3.5.32",
"@types/lodash": "4.14.162",
"@types/node": "16.18.32",
"@types/node-fetch": "^2.6.11",
"@types/vue-clickaway": "2.2.0",
"@types/qs": "^6.9.5",
"@types/request-promise": "^4.1.46",
Expand All @@ -32,6 +33,7 @@
"electron-settings": "~4.0.2",
"extract-loader": "^5.1.0",
"file-loader": "^6.2.0",
"json-loader": "^0.5.7",
"lodash": "^4.17.20",
"sass": "^1.68.0",
"optimize-css-assets-webpack-plugin": "^5.0.4",
Expand All @@ -54,10 +56,10 @@
"vue-lazyload": "1.3.5",
"vue-loader": "15.9.8",
"vue-template-compiler": "2.6.12",
"webpack": "5.8.0"
"webpack": "5.92.1"
},
"dependencies": {
"@cliqz/adblocker-electron": "~1.26.12",
"@cliqz/adblocker-electron": "~1.27.11",
"jquery": "^3.7.1",
"node-fetch": "^2.7.0"
},
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"experimentalDecorators": true
"experimentalDecorators": true,
},
"include": ["./electron/main.ts"]
}
6 changes: 5 additions & 1 deletion webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ function compilerCallback(err, stats) {
const statsString = stats.toString({colors: require("supports-color"), context: config[0].context, cached: false, cachedAssets: false, exclude: ['node_modules']});
if(statsString) process.stdout.write(statsString + '\n');
}
if(mode !== 'watch' && stats.hasErrors()) process.exitCode = 2;

if(mode !== 'watch' && stats.hasErrors()) {
process.exitCode = 2;
console.error('FULL ERROR', stats.stats[0].compilation.errors[0]);
}
}

console.log(config);
Expand Down
Loading

0 comments on commit 4aa4a5e

Please sign in to comment.