Skip to content

Commit 7669906

Browse files
committed
1.0.7
* Fixed css import error * Dropped devServer host,port properties * Removed is-windows dev dependency * Added default *.json declaration * Removed husky due to simple-git-hooks * Bump dependencies
1 parent d166c3a commit 7669906

File tree

11 files changed

+61
-51
lines changed

11 files changed

+61
-51
lines changed

package.json

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack-typescript-react",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "Webpack 5 boilerplate with support of most common loaders and modules",
55
"keywords": [
66
"react",
@@ -20,91 +20,90 @@
2020
"build": "cross-env NODE_ENV=production webpack --config webpack.config.babel.js",
2121
"profile": "cross-env NODE_ENV=production webpack --profile --json --config webpack.config.babel.js > ./dist/profile.json && webpack-bundle-analyzer ./dist/profile.json",
2222
"start": "cross-env WEBPACK_IS_DEV_SERVER=true NODE_ENV=development webpack serve --config webpack.config.babel.js",
23-
"release": "npm version patch"
23+
"release": "npm version patch",
24+
"update-hooks": "npx simple-git-hooks",
25+
"prerelease": "npm run update-hooks",
26+
"postinstall": "npm run update-hooks"
2427
},
25-
"husky": {
26-
"hooks": {
27-
"pre-commit": "lint-staged",
28-
"post-commit": "git update-index --again"
29-
}
28+
"simple-git-hooks": {
29+
"pre-commit": "npx lint-staged",
30+
"post-commit": "git update-index --again"
3031
},
3132
"dependencies": {
3233
"@types/classnames": "^2.3.0",
33-
"@types/react": "^17.0.37",
34+
"@types/react": "^17.0.38",
3435
"@types/react-dom": "^17.0.11",
3536
"classnames": "^2.3.1",
3637
"normalize.css": "^8.0.1",
3738
"react": "^17.0.2",
3839
"react-dom": "^17.0.2"
3940
},
4041
"devDependencies": {
41-
"@babel/core": "~7.16.0",
42-
"@babel/plugin-proposal-class-properties": "~7.16.0",
43-
"@babel/plugin-proposal-export-default-from": "^7.16.0",
44-
"@babel/plugin-proposal-export-namespace-from": "~7.16.0",
45-
"@babel/plugin-proposal-object-rest-spread": "~7.16.0",
46-
"@babel/plugin-proposal-throw-expressions": "~7.16.0",
42+
"@babel/core": "~7.16.7",
43+
"@babel/plugin-proposal-class-properties": "~7.16.7",
44+
"@babel/plugin-proposal-export-default-from": "^7.16.7",
45+
"@babel/plugin-proposal-export-namespace-from": "~7.16.7",
46+
"@babel/plugin-proposal-object-rest-spread": "~7.16.7",
47+
"@babel/plugin-proposal-throw-expressions": "~7.16.7",
4748
"@babel/plugin-syntax-dynamic-import": "~7.8.3",
48-
"@babel/plugin-transform-runtime": "~7.16.4",
49-
"@babel/preset-env": "~7.16.4",
50-
"@babel/preset-react": "~7.16.0",
51-
"@babel/register": "~7.16.0",
52-
"@pmmmwh/react-refresh-webpack-plugin": "~0.5.3",
49+
"@babel/plugin-transform-runtime": "~7.16.7",
50+
"@babel/preset-env": "~7.16.7",
51+
"@babel/preset-react": "~7.16.7",
52+
"@babel/register": "~7.16.7",
53+
"@pmmmwh/react-refresh-webpack-plugin": "~0.5.4",
5354
"@svgr/webpack": "~6.1.2",
5455
"@teamsupercell/typings-for-css-modules-loader": "~2.5.1",
55-
"@typescript-eslint/eslint-plugin": "~5.6.0",
56-
"@typescript-eslint/parser": "~5.6.0",
57-
"autoprefixer": "~10.4.0",
56+
"@typescript-eslint/eslint-plugin": "~5.9.0",
57+
"@typescript-eslint/parser": "~5.9.0",
58+
"autoprefixer": "~10.4.2",
5859
"babel-eslint": "~10.1.0",
5960
"babel-loader": "~8.2.3",
6061
"clean-webpack-plugin": "~4.0.0",
61-
"copy-webpack-plugin": "~10.1.0",
62-
"core-js": "~3.19.3",
62+
"copy-webpack-plugin": "~10.2.0",
63+
"core-js": "~3.20.2",
6364
"cross-env": "^7.0.3",
6465
"css-loader": "~6.5.1",
65-
"cssnano": "~5.0.12",
66-
"eslint": "~8.4.1",
66+
"cssnano": "~5.0.15",
67+
"eslint": "~8.6.0",
6768
"eslint-config-airbnb-base": "~15.0.0",
6869
"eslint-config-airbnb-typescript": "~16.1.0",
6970
"eslint-config-prettier": "~8.3.0",
7071
"eslint-import-resolver-alias": "~1.1.2",
71-
"eslint-plugin-import": "~2.25.3",
72+
"eslint-plugin-import": "~2.25.4",
7273
"eslint-plugin-jsx-a11y": "~6.5.1",
73-
"eslint-plugin-react": "~7.27.1",
74+
"eslint-plugin-react": "~7.28.0",
7475
"eslint-plugin-react-hooks": "~4.3.0",
7576
"eslint-webpack-plugin": "~3.1.1",
7677
"fork-ts-checker-webpack-plugin": "~6.5.0",
77-
"html-loader": "~3.0.1",
78+
"html-loader": "~3.1.0",
7879
"html-webpack-plugin": "~5.5.0",
79-
"husky": "~7.0.4",
8080
"import-sort-style-module-and-prefix": "~0.1.3",
81-
"is-windows": "~1.0.2",
8281
"less": "~4.1.2",
8382
"less-loader": "~10.2.0",
84-
"lint-staged": "~12.1.2",
85-
"mini-css-extract-plugin": "~2.4.5",
83+
"mini-css-extract-plugin": "~2.4.6",
8684
"path": "~0.12.7",
8785
"postcss": "~8.4.5",
8886
"postcss-loader": "~6.2.1",
8987
"prettier": "~2.5.1",
9088
"prettier-plugin-import-sort": "~0.0.7",
91-
"pretty-quick": "~3.1.2",
89+
"pretty-quick": "~3.1.3",
9290
"react-refresh": "~0.11.0",
9391
"regenerator-runtime": "~0.13.9",
9492
"resolve-url-loader": "~4.0.0",
95-
"sass": "~1.45.0",
93+
"sass": "~1.47.0",
9694
"sass-loader": "~12.4.0",
9795
"sass-resources-loader": "~2.2.4",
96+
"simple-git-hooks": "^2.7.0",
9897
"style-loader": "~3.3.1",
9998
"svg-url-loader": "~7.1.1",
100-
"terser-webpack-plugin": "~5.2.5",
99+
"terser-webpack-plugin": "~5.3.0",
101100
"ts-loader": "~9.2.6",
102-
"typescript": "~4.5.3",
101+
"typescript": "~4.5.4",
103102
"url-loader": "~4.1.1",
104103
"webpack": "~5.65.0",
105104
"webpack-bundle-analyzer": "~4.5.0",
106105
"webpack-cli": "~4.9.1",
107-
"webpack-dev-server": "~4.6.0",
106+
"webpack-dev-server": "~4.7.2",
108107
"webpack-merge": "~5.8.0"
109108
},
110109
"importSort": {

src/@types/declarations.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ declare module "*.svg" {
1414
export default ReactComponent;
1515
}
1616

17+
declare module '*.json' {
18+
const content: Record<string, string>;
19+
export default content;
20+
}
21+
1722
declare const IS_PROD: boolean;
1823
declare const IS_DEV: boolean;
1924
declare const IS_DEV_SERVER: boolean;

src/components/app/app.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import cn from 'classnames';
66
import React, {Suspense, lazy} from 'react';
77

8+
import packageJson from '../../../package.json';
89
import {stylesContainer} from './app.module.less';
910
import {stylesHeader, stylesImage, stylesLink} from './app.module.scss';
1011

@@ -21,7 +22,7 @@ export const App = (): React.ReactElement => (
2122
href="https://github.com/glook/webpack-typescript-react"
2223
target="_blank"
2324
>
24-
@glook/webpack-typescript-react
25+
@glook/webpack-typescript-react ({packageJson.version})
2526
</a>
2627
</div>
2728
</div>

src/index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8" />
5+
<meta
6+
name="viewport"
7+
content="width=device-width, initial-scale=1.0, maximum-scale=1.5, minimum-scale=0.9, user-scalable=yes"
8+
/>
59
<title>Webpack5 typescript react boilerplate</title>
10+
<link rel="preconnect" href="https://fonts.googleapis.com" />
11+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
612
<link
7-
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@600;400&display=swap"
13+
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap"
814
rel="stylesheet"
915
/>
1016
</head>

src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import '@styles/styles.css';
12
/**
23
* Created by: Andrey Polyakov (andrey@polyakov.im)
34
*/

src/styles/styles.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#root {
2+
background: #fff;
3+
}

webpack/base.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44
import path from 'path';
55

6-
import {aliasItems, devServerUrl, externalItems} from './config';
6+
import {aliasItems, externalItems} from './config';
77
import entry from './entry';
88
import optimization from './optimization';
99
import * as plugins from './plugins';
@@ -18,7 +18,7 @@ export default {
1818
entry,
1919
output: {
2020
path: path.join(__dirname, '../dist'),
21-
publicPath: isDevServer ? devServerUrl : './',
21+
publicPath: isDevServer ? undefined : './',
2222
filename: isDevServer
2323
? '[name].[fullhash].js'
2424
: '[name].[contenthash].js',

webpack/config/devServer.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,15 @@
33
* @see https://webpack.js.org/configuration/dev-server/
44
*/
55

6-
import {defaultPort, devServerHost} from '../utils/env';
76
import {devServerProxyConfig} from './devServierProxy';
87

9-
export const devServerUrl = `http://${devServerHost}:${defaultPort}/`;
10-
118
export const devServerConfig = {
129
client: {
1310
overlay: false,
1411
},
1512
headers: {'Access-Control-Allow-Origin': '*'},
1613
historyApiFallback: true,
17-
host: devServerHost,
1814
hot: true,
19-
port: defaultPort,
2015
proxy: devServerProxyConfig,
2116
static: {
2217
publicPath: '/',

webpack/config/devServierProxy.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ const httpsProxyTarget = {
1515
};
1616

1717
export const devServerProxyConfig = {
18+
/*
19+
// Example proxy configuration endpoins
1820
'/world-time': {
1921
target: `${httpsProxyTarget.protocol}://worldtimeapi.org:${httpsProxyTarget.port}`,
2022
pathRewrite: pathRewrite('^/world-time/test', '/api'),
@@ -27,4 +29,5 @@ export const devServerProxyConfig = {
2729
changeOrigin: true,
2830
secure: false,
2931
},
32+
*/
3033
};

webpack/rules/styles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
/** css **/
1717
export const cssRule = {
1818
test: /\.css$/,
19-
use: [miniCssExtractLoader, postCssLoader, resolveUrlLoader, cssLoader],
19+
use: [miniCssExtractLoader, cssLoader, postCssLoader],
2020
};
2121

2222
/** less **/

webpack/utils/env.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33
*/
44
import {join} from 'path';
55

6-
import isWindows from 'is-windows';
7-
86
export const mode = process.env.NODE_ENV ?? 'production';
97
export const isDevServer = process.env.WEBPACK_IS_DEV_SERVER === 'true';
108
export const isProd = mode === 'production';
119
export const isDev = !isProd;
1210
export const rootDir = join(__dirname, '../../');
1311
export const webpackDir = join(__dirname, '../');
1412
export const defaultPort = 8080;
15-
export const devServerHost = isWindows() ? '127.0.0.1' : '0.0.0.0';

0 commit comments

Comments
 (0)