Skip to content

Commit 5bcc62c

Browse files
committed
0.0.9
* packages was updated to latest version * node-sass was replaced to dart sass * eslint-loader was replaced to eslint-webpack-plugin cause it was marked as deprecated
1 parent 50eee12 commit 5bcc62c

File tree

11 files changed

+94
-73
lines changed

11 files changed

+94
-73
lines changed

package.json

Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack-typescript-react",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "",
55
"license": "ISC",
66
"author": "",
@@ -17,91 +17,96 @@
1717
},
1818
"dependencies": {
1919
"@types/classnames": "^2.2.10",
20-
"@types/react": "^16.9.46",
20+
"@types/react": "^16.9.51",
2121
"@types/react-dom": "^16.9.8",
2222
"classnames": "^2.2.6",
2323
"normalize.css": "^8.0.1",
2424
"react": "^16.13.1",
2525
"react-dom": "^16.13.1"
2626
},
2727
"devDependencies": {
28-
"@babel/core": "^7.11.1",
28+
"@babel/core": "^7.11.6",
2929
"@babel/plugin-proposal-class-properties": "^7.10.4",
3030
"@babel/plugin-proposal-export-namespace-from": "^7.10.4",
3131
"@babel/plugin-proposal-object-rest-spread": "^7.11.0",
3232
"@babel/plugin-proposal-throw-expressions": "^7.10.4",
3333
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
34-
"@babel/plugin-transform-runtime": "^7.11.0",
35-
"@babel/preset-env": "^7.11.0",
34+
"@babel/plugin-transform-runtime": "^7.11.5",
35+
"@babel/preset-env": "^7.11.5",
3636
"@babel/preset-react": "^7.10.4",
37-
"@babel/register": "^7.10.5",
38-
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.1",
37+
"@babel/register": "^7.11.5",
38+
"@pmmmwh/react-refresh-webpack-plugin": "^0.4.2",
3939
"@svgr/webpack": "^5.4.0",
40-
"@teamsupercell/typings-for-css-modules-loader": "^2.2.1",
41-
"@typescript-eslint/eslint-plugin": "^3.9.0",
42-
"@typescript-eslint/parser": "^3.9.0",
40+
"@teamsupercell/typings-for-css-modules-loader": "^2.3.0",
41+
"@typescript-eslint/eslint-plugin": "^4.4.0",
42+
"@typescript-eslint/parser": "^4.4.0",
4343
"autoprefixer": "^9.8.6",
4444
"babel-eslint": "^10.1.0",
4545
"babel-loader": "^8.1.0",
4646
"clean-webpack-plugin": "^3.0.0",
47-
"copy-webpack-plugin": "^6.0.3",
47+
"copy-webpack-plugin": "^6.2.0",
4848
"core-js": "^3.6.5",
49-
"css-loader": "4.2.1",
49+
"css-loader": "4.3.0",
5050
"cssnano": "^4.1.10",
51-
"eslint": "^7.7.0",
51+
"eslint": "^7.10.0",
5252
"eslint-config-airbnb-base": "^14.2.0",
53-
"eslint-config-airbnb-typescript": "^9.0.0",
54-
"eslint-config-prettier": "^6.11.0",
53+
"eslint-config-airbnb-typescript": "^11.0.0",
54+
"eslint-config-prettier": "^6.12.0",
5555
"eslint-import-resolver-alias": "^1.1.2",
56-
"eslint-loader": "^4.0.2",
57-
"eslint-plugin-import": "^2.22.0",
56+
"eslint-plugin-import": "^2.22.1",
5857
"eslint-plugin-jsx-a11y": "^6.3.1",
59-
"eslint-plugin-react": "^7.20.6",
60-
"eslint-plugin-react-hooks": "^4.0.8",
58+
"eslint-plugin-react": "^7.21.3",
59+
"eslint-plugin-react-hooks": "^4.1.2",
60+
"eslint-webpack-plugin": "^2.1.0",
6161
"expose-loader": "1.0.0",
6262
"extract-text-webpack-plugin": "^4.0.0-beta.0",
63-
"file-loader": "6.0.0",
64-
"fork-ts-checker-webpack-plugin": "^5.0.14",
65-
"html-loader": "^1.1.0",
66-
"html-webpack-plugin": "^4.3.0",
67-
"husky": "^4.2.5",
63+
"file-loader": "6.1.0",
64+
"fork-ts-checker-webpack-plugin": "^5.2.0",
65+
"html-loader": "^1.3.1",
66+
"html-webpack-plugin": "^4.5.0",
67+
"husky": "^4.3.0",
6868
"import-sort-style-module-and-prefix": "^0.1.3",
6969
"is-windows": "^1.0.2",
7070
"less": "^3.12.2",
71-
"less-loader": "^6.2.0",
72-
"lint-staged": "^10.2.11",
71+
"less-loader": "^7.0.1",
72+
"lint-staged": "^10.4.0",
7373
"lodash": "^4.17.20",
74-
"mini-css-extract-plugin": "^0.10.0",
75-
"node-sass": "4.14.1",
74+
"mini-css-extract-plugin": "^0.11.3",
7675
"path": "^0.12.7",
77-
"postcss-loader": "3.0.0",
78-
"prettier": "^2.0.5",
79-
"prettier-plugin-import-sort": "0.0.4",
80-
"pretty-quick": "^2.0.1",
76+
"postcss-loader": "4.0.3",
77+
"prettier": "^2.1.2",
78+
"prettier-plugin-import-sort": "0.0.6",
79+
"pretty-quick": "^3.0.2",
8180
"react-refresh": "^0.8.3",
8281
"regenerator-runtime": "^0.13.7",
8382
"resolve-url-loader": "^3.1.1",
84-
"sass-loader": "^9.0.3",
85-
"sass-resources-loader": "^2.0.3",
86-
"style-loader": "1.2.1",
83+
"sass": "^1.27.0",
84+
"sass-loader": "^10.0.2",
85+
"sass-resources-loader": "^2.1.1",
86+
"speed-measure-webpack-plugin": "^1.3.3",
87+
"style-loader": "1.3.0",
8788
"svg-url-loader": "^6.0.0",
88-
"terser-webpack-plugin": "^4.1.0",
89-
"thread-loader": "^2.1.3",
90-
"ts-loader": "^8.0.2",
91-
"typescript": "^3.9.7",
89+
"terser-webpack-plugin": "^4.2.2",
90+
"thread-loader": "^3.0.0",
91+
"ts-loader": "^8.0.4",
92+
"typescript": "^4.0.3",
9293
"url-loader": "4.1.0",
93-
"webpack": "^4.44.1",
94+
"webpack": "^4.44.2",
9495
"webpack-cli": "^3.3.12",
9596
"webpack-dev-server": "^3.11.0",
96-
"webpack-merge": "5.1.1",
97+
"webpack-merge": "5.1.4",
9798
"webpack-serve": "^3.2.0",
9899
"webpack-stats-plugin": "0.3.2",
99-
"yargs": "^15.4.1"
100+
"yargs": "^16.0.3"
100101
},
101102
"importSort": {
102-
".js, .jsx, .ts, .tsx": {
103+
".ts, .tsx": {
103104
"style": "module-and-prefix",
104105
"parser": "typescript"
106+
},
107+
".js, .jsx": {
108+
"style": "module-and-prefix",
109+
"parser": "babylon"
105110
}
106111
}
107112
}

src/components/app/app.module.less.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@
22
// Please do not change this file!
33
declare namespace AppModuleLessNamespace {
44
export interface IAppModuleLess {
5-
file: string;
6-
mappings: string;
7-
names: string;
8-
sources: string;
9-
sourcesContent: string;
105
stylesContainer: string;
11-
version: string;
126
}
137
}
148

src/components/app/app.module.scss.d.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@
22
// Please do not change this file!
33
declare namespace AppModuleScssNamespace {
44
export interface IAppModuleScss {
5-
file: string;
6-
mappings: string;
7-
names: string;
8-
sources: string;
9-
sourcesContent: string;
105
stylesHeader: string;
116
stylesImage: string;
12-
version: string;
137
}
148
}
159

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"@components/*": ["src/components/*"]
2323
},
2424
"allowSyntheticDefaultImports": true,
25-
"esModuleInterop": true
25+
"esModuleInterop": true,
26+
"importsNotUsedAsValues": "preserve"
2627
},
2728
"exclude": ["node_modules", "webpack"]
2829
}

webpack/constants/loadersList.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export const sassLoader = [
3131
loader: 'sass-loader',
3232
options: {
3333
sourceMap: true,
34+
// Prefer `dart-sass`
35+
implementation: require('sass'),
3436
},
3537
},
3638
resources.length
@@ -46,8 +48,8 @@ export const sassLoader = [
4648
export const postCssLoader = {
4749
loader: 'postcss-loader',
4850
options: {
49-
config: {
50-
path: __dirname,
51+
postcssOptions: {
52+
config: resolve(__dirname, '../postcss.config.js'),
5153
},
5254
sourceMap: isProd,
5355
},

webpack/env.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
/**
22
* Created by: Andrey Polyakov (andrey@polyakov.im)
33
*/
4+
import {join} from 'path';
5+
46
import get from 'lodash/get';
57
import {argv} from 'yargs';
68

79
export const mode = get(argv, 'env.mode', 'production');
810
export const isDevServer = get(argv, 'env.isDevServer', false);
911
export const isProd = mode === 'production';
1012
export const isDev = !isProd;
13+
export const rootDir = join(__dirname, '../');

webpack/helpers.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Created by: Andrey Polyakov (andrey@polyakov.im)
3+
*/
4+
export const arrayFilterEmpty = (array) => array.filter((x) => !!x);

webpack/loaders.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,56 +12,57 @@ import {
1212
sassLoader,
1313
typingsCssModulesLoader,
1414
} from './constants/loadersList';
15+
import {arrayFilterEmpty} from './helpers';
1516

1617
export default [
1718
{
1819
test: /\.(js|jsx)$/,
19-
use: ['thread-loader', babelLoader, 'eslint-loader'],
20+
use: ['thread-loader', babelLoader],
2021
exclude: /node_modules/,
2122
},
2223
{
2324
test: /\.module\.s([ca])ss$/,
24-
use: [
25+
use: arrayFilterEmpty([
2526
miniCssExtractLoader,
2627
typingsCssModulesLoader,
2728
cssModulesLoader,
2829
postCssLoader,
2930
resolveUrlLoader,
3031
...sassLoader,
31-
].filter((x) => !!x),
32+
]),
3233
},
3334
{
3435
test: /\.s([ca])ss$/,
3536
exclude: /\.module.scss$/,
36-
use: [
37+
use: arrayFilterEmpty([
3738
miniCssExtractLoader,
3839
cssLoader,
3940
postCssLoader,
4041
resolveUrlLoader,
4142
...sassLoader,
42-
].filter((x) => !!x),
43+
]),
4344
},
4445
{
4546
test: /\.module.less$/,
46-
use: [
47+
use: arrayFilterEmpty([
4748
miniCssExtractLoader,
4849
typingsCssModulesLoader,
4950
cssModulesLoader,
5051
postCssLoader,
5152
resolveUrlLoader,
5253
lessLoader,
53-
].filter((x) => !!x),
54+
]),
5455
},
5556
{
5657
test: /\.less$/,
5758
exclude: /\.module.less$/,
58-
use: [
59+
use: arrayFilterEmpty([
5960
miniCssExtractLoader,
6061
cssLoader,
6162
postCssLoader,
6263
resolveUrlLoader,
6364
lessLoader,
64-
].filter((x) => !!x),
65+
]),
6566
},
6667
{
6768
test: /\.css$/,

webpack/plugins.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
/**
22
* Created by: Andrey Polyakov (andrey@polyakov.im)
33
*/
4-
import {resolve} from 'path';
4+
import {join, resolve} from 'path';
55

66
import {CleanWebpackPlugin} from 'clean-webpack-plugin';
7+
import ESLintPlugin from 'eslint-webpack-plugin';
78
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
89
import HtmlWebpackPlugin from 'html-webpack-plugin';
910
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
1011
import {DefinePlugin, ProvidePlugin} from 'webpack';
1112

12-
import {isDev} from './env';
13+
import {isDev, rootDir} from './env';
1314
import defineList from './resources/define';
1415
import htmlPluginConfg from './resources/html';
1516
import provideList from './resources/provide';
@@ -28,9 +29,14 @@ export default [
2829
new ForkTsCheckerWebpackPlugin({
2930
async: isDev,
3031
typescript: {
31-
configFile: resolve(__dirname, '../tsconfig.json'),
32+
configFile: join(rootDir, '/tsconfig.json'),
3233
},
3334
eslint: {enabled: true, files: '../src/**/*.{ts,tsx,js,jsx}'},
3435
logger: {infrastructure: 'silent', issues: 'console'},
3536
}),
37+
new ESLintPlugin({
38+
context: join(rootDir, '/src'),
39+
extensions: ['js', 'jsx', 'ts', 'tsx'],
40+
formatter: 'table',
41+
}),
3642
];

webpack/postcss.config.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1-
module.exports = {
2-
plugins: [require('autoprefixer')({}), require('cssnano')()],
1+
import {arrayFilterEmpty} from './helpers';
2+
3+
module.exports = (api) => {
4+
const {mode} = api;
5+
6+
const plugins = arrayFilterEmpty([
7+
'cssnano',
8+
mode !== 'development' ? 'cssnano' : null,
9+
]);
10+
11+
return {
12+
plugins,
13+
};
314
};

webpack/prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import {CleanWebpackPlugin} from 'clean-webpack-plugin';
21
/**
32
* Created by: Andrey Polyakov (andrey@polyakov.im)
43
*/
4+
import {CleanWebpackPlugin} from 'clean-webpack-plugin';
55
import TerserJSPlugin from 'terser-webpack-plugin';
66

77
export default {

0 commit comments

Comments
 (0)