Skip to content

Commit 45a7831

Browse files
committed
Merge branch 'feature/webpack4' into develop
2 parents df3061d + 21f9cae commit 45a7831

9 files changed

+1989
-787
lines changed

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
webpack.config.js

app/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "checksum-validator",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Small Electron application to validate checksums.",
55
"main": "build/main.js",
66
"author": "Alexander Weiss",

app/renderer/src/components/ChecksOverview.component.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ChecksOverview extends React.Component<any, any> {
5050
};
5151

5252
deleteCancel = e => {
53-
console.log(e);
53+
//doNothing
5454
};
5555

5656
render() {

app/renderer/src/styles/style.less

-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
@import '../../../node_modules/antd/dist/antd.less'; // import official less entry file, but consider to switch to the babel-plugin-import way
21
@import 'antd-icons.css';
32
@import 'theme.less';

app/renderer/src/styles/theme.less

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
@import './app.less';
22
@import './nc-icons.css';
3-
@import './colors.less';
3+
@import './ant-default-vars.less';
44

55
strong {
66
color: @primary-color;

package.json

+12-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "checksum-validator",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Small Electron application to validate checksums.",
55
"scripts": {
66
"babel:watch": "babel ./app/main/src/ -w -d ./app/main/build",
@@ -24,34 +24,33 @@
2424
"@types/react": "^16.0.18",
2525
"@types/react-dom": "^16.0.2",
2626
"@types/react-transition-group": "^2.0.6",
27-
"@types/username": "^3.0.0",
28-
"awesome-typescript-loader": "^3.2.3",
2927
"chai": "^4.1.2",
3028
"chai-as-promised": "^7.1.1",
3129
"copy-webpack-plugin": "^4.2.0",
32-
"css-loader": "^0.28.7",
30+
"css-loader": "^0.28.10",
3331
"electron": "^1.8.2",
34-
"electron-builder": "^20.0.4",
32+
"electron-builder": "^20.3.1",
3533
"electron-devtools-installer": "^2.2.3",
3634
"electron-react-devtools": "^0.5.3",
3735
"electron-reload": "^1.1.0",
38-
"extract-text-webpack-plugin": "^3.0.2",
39-
"file-loader": "^1.1.6",
36+
"extract-text-webpack-plugin": "^4.0.0-beta.0",
37+
"file-loader": "^1.1.11",
4038
"less": "^2.7.1",
41-
"less-loader": "^4.0.5",
39+
"less-loader": "^4.0.6",
40+
"less-vars-to-js": "^1.2.1",
4241
"mocha": "^5.0.1",
4342
"spectron": "^3.7.2",
44-
"style-loader": "^0.20.1",
43+
"style-loader": "^0.20.2",
4544
"ts-import-plugin": "^1.4.3",
46-
"ts-loader": "^3.5.0",
45+
"ts-loader": "^4.0.1",
4746
"ts-node": "^4.1.0",
4847
"tslint": "^5.8.0",
4948
"tslint-config-airbnb": "^5.3.0",
5049
"tslint-config-prettier": "^1.6.0",
5150
"typescript": "^2.7.1",
52-
"url-loader": "^0.6.2",
53-
"webpack": "^3.8.1",
54-
"webpack-dashboard": "^1.0.0",
51+
"url-loader": "^1.0.1",
52+
"webpack": "^4.1.0",
53+
"webpack-cli": "^2.0.10",
5554
"webpack-node-externals": "^1.6.0"
5655
},
5756
"build": {

webpack.config.js

+26-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
const ExtractTextPlugin = require('extract-text-webpack-plugin');
2-
const DashboardPlugin = require('webpack-dashboard/plugin');
32
const CopyWebpackPlugin = require('copy-webpack-plugin');
43
const nodeExternals = require('webpack-node-externals');
54
const tsImportPluginFactory = require('ts-import-plugin');
65
const path = require('path');
6+
const fs = require('fs');
7+
const lessToJs = require('less-vars-to-js');
8+
9+
const themeVariables = lessToJs(fs.readFileSync(path.join(__dirname, './app/renderer/src/styles/ant-default-vars.less'), 'utf8'));
10+
themeVariables["@icon-url"] = "'/'";
11+
712
module.exports = function(env) {
813
console.log(env);
914
let config = {
1015
module: {},
1116
};
1217

1318
let rendererConfig = Object.assign({}, config, {
19+
mode: 'production',
1420
watch: env.mode == 'watch' ? true : false,
1521
target: 'electron-renderer',
1622
node: {
@@ -33,11 +39,17 @@ module.exports = function(env) {
3339
test: /\.(jsx|tsx|js|ts)$/,
3440
use: [
3541
{
36-
loader: 'awesome-typescript-loader',
42+
loader: 'ts-loader',
3743
options: {
3844
transpileOnly: true,
3945
getCustomTransformers: () => ({
40-
before: [tsImportPluginFactory(/** options */)],
46+
before: [
47+
tsImportPluginFactory({
48+
libraryName: 'antd',
49+
libraryDirectory: 'lib',
50+
style: true,
51+
}),
52+
],
4153
}),
4254
compilerOptions: {
4355
module: 'es2015',
@@ -56,7 +68,15 @@ module.exports = function(env) {
5668
},
5769
{
5870
test: /\.less$/,
59-
use: ExtractTextPlugin.extract(['css-loader', 'less-loader']),
71+
use: [
72+
{loader: "style-loader"},
73+
{loader: "css-loader"},
74+
{loader: "less-loader",
75+
options: {
76+
modifyVars: themeVariables
77+
}
78+
}
79+
]
6080
},
6181
{
6282
test: /\.(png|jpg|gif|svg)$/,
@@ -81,11 +101,11 @@ module.exports = function(env) {
81101
disable: false,
82102
allChunks: true,
83103
}),
84-
new DashboardPlugin(),
85104
],
86105
});
87106

88107
let mainConfig = Object.assign({}, config, {
108+
mode: 'production',
89109
entry: './app/main/src/main.ts',
90110
target: 'electron-main',
91111
node: {
@@ -104,15 +124,14 @@ module.exports = function(env) {
104124
rules: [
105125
{
106126
test: /.ts$/,
107-
use: [{ loader: 'awesome-typescript-loader' }],
127+
use: [{ loader: 'ts-loader' }],
108128
},
109129
],
110130
},
111131
plugins: [
112132
new CopyWebpackPlugin([
113133
{ from: 'app/lib/i18n/', to: 'app/build/', ignore: ['*.ts'] },
114134
]),
115-
new DashboardPlugin(),
116135
],
117136
});
118137

0 commit comments

Comments
 (0)