From e3641c7e10c39992e815b03a17244fc0d3210a10 Mon Sep 17 00:00:00 2001 From: JiangWeixian Date: Wed, 22 Jun 2022 21:36:40 +0800 Subject: [PATCH 1/5] :heavy_plus_sign: add webpack-env support module variables https://webpack.js.org/api/module-variables/ --- package.json | 2 +- pnpm-lock.yaml | 142 ++++++++++++++++++++++++------------------------- 2 files changed, 72 insertions(+), 72 deletions(-) diff --git a/package.json b/package.json index 20df337..3272b4a 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "@types/react-router-dom": "5.3.3", "@types/react-test-renderer": "18.0.0", "@types/webpack-bundle-analyzer": "4.4.1", - "@types/webpack-env": "1.16.3", + "@types/webpack-env": "1.17.0", "@vue/preload-webpack-plugin": "2.0.0", "autoprefixer": "10.4.7", "clean-webpack-plugin": "4.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d4c16c5..daef07d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: 5.4 +lockfileVersion: 5.3 specifiers: '@aiou/eslint-config': 0.5.1 @@ -20,7 +20,7 @@ specifiers: '@types/react-router-dom': 5.3.3 '@types/react-test-renderer': 18.0.0 '@types/webpack-bundle-analyzer': 4.4.1 - '@types/webpack-env': 1.16.3 + '@types/webpack-env': 1.17.0 '@vue/preload-webpack-plugin': 2.0.0 autoprefixer: 10.4.7 axios: 0.26.1 @@ -92,18 +92,18 @@ dependencies: clsx: 1.1.1 react: 18.0.0 react-dom: 18.0.0_react@18.0.0 - react-redux: 7.2.8_zpnidt7m3osuk7shl3s4oenomq + react-redux: 7.2.8_react-dom@18.0.0+react@18.0.0 react-router: 6.3.0_react@18.0.0 - react-router-dom: 6.3.0_zpnidt7m3osuk7shl3s4oenomq + react-router-dom: 6.3.0_react-dom@18.0.0+react@18.0.0 redux: 4.1.2 swr: 1.3.0_react@18.0.0 devDependencies: - '@aiou/eslint-config': 0.5.1_6ekfr45vvgvmp233n2bwogrswm + '@aiou/eslint-config': 0.5.1_f11458f3b5a9aac7eb7b6e83671a32b3 '@babel/core': 7.17.9 '@babel/preset-react': 7.16.7_@babel+core@7.17.9 '@changesets/cli': 2.22.0 - '@pmmmwh/react-refresh-webpack-plugin': 0.5.5_36rna4wqw7umaapjpkcpg5wcba + '@pmmmwh/react-refresh-webpack-plugin': 0.5.5_dfa2d072d0b7e8c001e97a84f376c208 '@soda/friendly-errors-webpack-plugin': 1.8.1_webpack@5.72.0 '@tailwindcss/typography': 0.5.2_tailwindcss@3.0.24 '@teamsupercell/typings-for-css-modules-loader': 2.5.1 @@ -117,8 +117,8 @@ devDependencies: '@types/react-router-dom': 5.3.3 '@types/react-test-renderer': 18.0.0 '@types/webpack-bundle-analyzer': 4.4.1_webpack-cli@4.9.2 - '@types/webpack-env': 1.16.3 - '@vue/preload-webpack-plugin': 2.0.0_qm2jaalpfx3ptlkhxwihh5vlvu + '@types/webpack-env': 1.17.0 + '@vue/preload-webpack-plugin': 2.0.0_833490016f2df6f9ad47bd9073f6abad autoprefixer: 10.4.7_postcss@8.4.12 clean-webpack-plugin: 4.0.0_webpack@5.72.0 compression-webpack-plugin: 9.2.0_webpack@5.72.0 @@ -130,11 +130,11 @@ devDependencies: cssnano: 5.1.7_postcss@8.4.12 cssnano-preset-advanced: 5.3.3_postcss@8.4.12 cz-emoji: 1.3.1 - daisyui: 2.14.0_eugea4grn4cvu7egfx7brhhdry + daisyui: 2.14.0_250c4070d16f055a7c862dfe189ce38e esbuild-loader: 2.18.0_webpack@5.72.0 eslint: 8.13.0 - eslint-plugin-jest: 26.1.4_pzpgen6zmm2jolojank4cxwjaa - fork-ts-checker-webpack-plugin: 7.2.4_4dvvomwfbhpgf7xcm7gogbdvgu + eslint-plugin-jest: 26.1.4_7e5e6237d96334972dc90355c15ec900 + fork-ts-checker-webpack-plugin: 7.2.4_typescript@4.6.3+webpack@5.72.0 html-webpack-plugin: 5.5.0_webpack@5.72.0 husky: 7.0.4 jest: 27.5.1 @@ -145,7 +145,7 @@ devDependencies: postcss: 8.4.12 postcss-import: 14.1.0_postcss@8.4.12 postcss-js: 4.0.0_postcss@8.4.12 - postcss-loader: 6.2.1_ophkbroklgd6jdvupnp5h6xq4i + postcss-loader: 6.2.1_postcss@8.4.12+webpack@5.72.0 postcss-preset-env: 7.4.3_postcss@8.4.12 postcss-url: 10.1.3_postcss@8.4.12 prettier: 2.6.2 @@ -156,12 +156,12 @@ devDependencies: size-plugin: 2.0.2_webpack@5.72.0 style-loader: 3.3.1_webpack@5.72.0 stylus: 0.57.0 - stylus-loader: 6.2.0_u75fwzlywerfxxt2up7yjpiu5i + stylus-loader: 6.2.0_stylus@0.57.0+webpack@5.72.0 stylus-supremacy: 2.15.0 tailwindcss: 3.0.24 terser-webpack-plugin: 5.3.1_webpack@5.72.0 ts-import-plugin: 2.0.0_typescript@4.6.3 - ts-jest: 27.1.4_dj5cswed7rznuujbynhmi4x2bq + ts-jest: 27.1.4_1a7a295883fc72da5121c34ec472fa0c tslib: 2.3.1 typescript: 4.6.3 typings-for-css-modules-loader: 1.7.0_css-loader@6.7.1 @@ -169,23 +169,23 @@ devDependencies: url-loader: 4.1.1_webpack@5.72.0 webpack: 5.72.0_webpack-cli@4.9.2 webpack-bundle-analyzer: 4.5.0 - webpack-cli: 4.9.2_udjrey2ydtzlvw3og7awxsnsq4 - webpack-dev-server: 4.8.1_q7qo2wgeiyigo3znjsjh7f36ue + webpack-cli: 4.9.2_a0d31263581cf2badb6e37c16bc9b287 + webpack-dev-server: 4.8.1_webpack-cli@4.9.2+webpack@5.72.0 webpack-merge: 5.8.0 webpackbar: 5.0.2_webpack@5.72.0 packages: - /@aiou/eslint-config-basic/0.4.1_dgzv6anmedwsgjqqjbmjombm7i: + /@aiou/eslint-config-basic/0.4.1_19b35f01ac20ed232610485897302cfa: resolution: {integrity: sha512-YbhdwfftP2IUiXDhL39abqyjQMp2rh+eeYkept4UK85iayPWeY0HMHhAjI2waiM1ksWjxUB7m65DajQRpU0RNw==} peerDependencies: eslint: '>=7.4.0' dependencies: eslint: 8.13.0 - eslint-config-standard: 17.0.0-0_nd7r54mxqh2lbcgyej5jz57y54 + eslint-config-standard: 17.0.0-0_68ff1ef19781f4b088d8227a9cf7f8ef eslint-plugin-eslint-comments: 3.2.0_eslint@8.13.0 eslint-plugin-html: 6.2.0 - eslint-plugin-import: 2.26.0_dgzv6anmedwsgjqqjbmjombm7i + eslint-plugin-import: 2.26.0_19b35f01ac20ed232610485897302cfa eslint-plugin-jsonc: 2.2.1_eslint@8.13.0 eslint-plugin-n: 14.0.0_eslint@8.13.0 eslint-plugin-promise: 6.0.0_eslint@8.13.0 @@ -200,12 +200,12 @@ packages: - supports-color dev: true - /@aiou/eslint-config-react/0.4.1_jzhokl4shvj5szf5bgr66kln2a: + /@aiou/eslint-config-react/0.4.1_eslint@8.13.0+typescript@4.6.3: resolution: {integrity: sha512-zfPfAxuZnjSutMC8yPVquUmIplj5QbjvKUUYl9hgVLXL8M9e921HLCBxW99bXaXHOrIBWK+mx+iL/qbOmaK5/w==} peerDependencies: eslint: '>=7.4.0' dependencies: - '@aiou/eslint-config-ts': 0.4.1_jzhokl4shvj5szf5bgr66kln2a + '@aiou/eslint-config-ts': 0.4.1_eslint@8.13.0+typescript@4.6.3 eslint: 8.13.0 eslint-plugin-react: 7.29.4_eslint@8.13.0 eslint-plugin-react-hooks: 4.4.0_eslint@8.13.0 @@ -216,15 +216,15 @@ packages: - typescript dev: true - /@aiou/eslint-config-ts/0.4.1_jzhokl4shvj5szf5bgr66kln2a: + /@aiou/eslint-config-ts/0.4.1_eslint@8.13.0+typescript@4.6.3: resolution: {integrity: sha512-rSQ50BxN+oot5dk+9Us4JEwxLlAZAui7YsbKNWV1yjqKI5a25noLNY1NcKMjrsVoTzrGHHY3AeWmMZtf+9Go9A==} peerDependencies: eslint: '>=7.4.0' typescript: '>=3.9' dependencies: - '@aiou/eslint-config-basic': 0.4.1_dgzv6anmedwsgjqqjbmjombm7i - '@typescript-eslint/eslint-plugin': 5.19.0_6nfnzbei2lspafh6mfbs24gl6i - '@typescript-eslint/parser': 5.19.0_jzhokl4shvj5szf5bgr66kln2a + '@aiou/eslint-config-basic': 0.4.1_19b35f01ac20ed232610485897302cfa + '@typescript-eslint/eslint-plugin': 5.19.0_f34adc8488d2e4f014fe61432d70cbf2 + '@typescript-eslint/parser': 5.19.0_eslint@8.13.0+typescript@4.6.3 eslint: 8.13.0 typescript: 4.6.3 transitivePeerDependencies: @@ -233,18 +233,18 @@ packages: - supports-color dev: true - /@aiou/eslint-config/0.5.1_6ekfr45vvgvmp233n2bwogrswm: + /@aiou/eslint-config/0.5.1_f11458f3b5a9aac7eb7b6e83671a32b3: resolution: {integrity: sha512-4iWiTGjfQSI26boqoTNokv9yxDHaHa9YSyN88ylYYNoD7b0XELaEtSLvMvH/h9LbxAHHr8Ro+SmiFE53uA5tsw==} peerDependencies: eslint: '>=7.4.0' prettier: '>=2.2.1' dependencies: - '@aiou/eslint-config-react': 0.4.1_jzhokl4shvj5szf5bgr66kln2a + '@aiou/eslint-config-react': 0.4.1_eslint@8.13.0+typescript@4.6.3 '@aiou/eslint-ignore': 0.2.0 '@aiou/eslint-plugin-progress': 0.2.0_eslint@8.13.0 eslint: 8.13.0 eslint-config-prettier: 8.5.0_eslint@8.13.0 - eslint-plugin-prettier: 4.0.0_dak2zfnx7mtmcpd5jcuo55rnb4 + eslint-plugin-prettier: 4.0.0_1815ac95b7fb26c13c7d48a8eef62d0f prettier: 2.6.2 transitivePeerDependencies: - eslint-import-resolver-typescript @@ -2201,7 +2201,7 @@ packages: fastq: 1.13.0 dev: true - /@pmmmwh/react-refresh-webpack-plugin/0.5.5_36rna4wqw7umaapjpkcpg5wcba: + /@pmmmwh/react-refresh-webpack-plugin/0.5.5_dfa2d072d0b7e8c001e97a84f376c208: resolution: {integrity: sha512-RbG7h6TuP6nFFYKJwbcToA1rjC1FyPg25NR2noAZ0vKI+la01KTSRPkuVPE+U88jXv7javx2JHglUcL1MHcshQ==} engines: {node: '>= 10.13'} peerDependencies: @@ -2238,7 +2238,7 @@ packages: schema-utils: 3.1.1 source-map: 0.7.3 webpack: 5.72.0_webpack-cli@4.9.2 - webpack-dev-server: 4.8.1_q7qo2wgeiyigo3znjsjh7f36ue + webpack-dev-server: 4.8.1_webpack-cli@4.9.2+webpack@5.72.0 dev: true /@polka/url/1.0.0-next.21: @@ -2677,8 +2677,8 @@ packages: - webpack-cli dev: true - /@types/webpack-env/1.16.3: - resolution: {integrity: sha512-9gtOPPkfyNoEqCQgx4qJKkuNm/x0R2hKR7fdl7zvTJyHnIisuE/LfvXOsYWL0o3qq6uiBnKZNNNzi3l0y/X+xw==} + /@types/webpack-env/1.17.0: + resolution: {integrity: sha512-eHSaNYEyxRA5IAG0Ym/yCyf86niZUIF/TpWKofQI/CVfh5HsMEUyfE2kwFxha4ow0s5g0LfISQxpDKjbRDrizw==} dev: true /@types/webpack-sources/3.2.0: @@ -2716,7 +2716,7 @@ packages: '@types/yargs-parser': 21.0.0 dev: true - /@typescript-eslint/eslint-plugin/5.19.0_6nfnzbei2lspafh6mfbs24gl6i: + /@typescript-eslint/eslint-plugin/5.19.0_f34adc8488d2e4f014fe61432d70cbf2: resolution: {integrity: sha512-w59GpFqDYGnWFim9p6TGJz7a3qWeENJuAKCqjGSx+Hq/bwq3RZwXYqy98KIfN85yDqz9mq6QXiY5h0FjGQLyEg==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2727,10 +2727,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/parser': 5.19.0_jzhokl4shvj5szf5bgr66kln2a + '@typescript-eslint/parser': 5.19.0_eslint@8.13.0+typescript@4.6.3 '@typescript-eslint/scope-manager': 5.19.0 - '@typescript-eslint/type-utils': 5.19.0_jzhokl4shvj5szf5bgr66kln2a - '@typescript-eslint/utils': 5.19.0_jzhokl4shvj5szf5bgr66kln2a + '@typescript-eslint/type-utils': 5.19.0_eslint@8.13.0+typescript@4.6.3 + '@typescript-eslint/utils': 5.19.0_eslint@8.13.0+typescript@4.6.3 debug: 4.3.4 eslint: 8.13.0 functional-red-black-tree: 1.0.1 @@ -2743,7 +2743,7 @@ packages: - supports-color dev: true - /@typescript-eslint/parser/5.19.0_jzhokl4shvj5szf5bgr66kln2a: + /@typescript-eslint/parser/5.19.0_eslint@8.13.0+typescript@4.6.3: resolution: {integrity: sha512-yhktJjMCJX8BSBczh1F/uY8wGRYrBeyn84kH6oyqdIJwTGKmzX5Qiq49LRQ0Jh0LXnWijEziSo6BRqny8nqLVQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2771,7 +2771,7 @@ packages: '@typescript-eslint/visitor-keys': 5.19.0 dev: true - /@typescript-eslint/type-utils/5.19.0_jzhokl4shvj5szf5bgr66kln2a: + /@typescript-eslint/type-utils/5.19.0_eslint@8.13.0+typescript@4.6.3: resolution: {integrity: sha512-O6XQ4RI4rQcBGshTQAYBUIGsKqrKeuIOz9v8bckXZnSeXjn/1+BDZndHLe10UplQeJLXDNbaZYrAytKNQO2T4Q==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2781,7 +2781,7 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/utils': 5.19.0_jzhokl4shvj5szf5bgr66kln2a + '@typescript-eslint/utils': 5.19.0_eslint@8.13.0+typescript@4.6.3 debug: 4.3.4 eslint: 8.13.0 tsutils: 3.21.0_typescript@4.6.3 @@ -2816,7 +2816,7 @@ packages: - supports-color dev: true - /@typescript-eslint/utils/5.19.0_jzhokl4shvj5szf5bgr66kln2a: + /@typescript-eslint/utils/5.19.0_eslint@8.13.0+typescript@4.6.3: resolution: {integrity: sha512-ZuEckdupXpXamKvFz/Ql8YnePh2ZWcwz7APICzJL985Rp5C2AYcHO62oJzIqNhAMtMK6XvrlBTZeNG8n7gS3lQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -2846,7 +2846,7 @@ packages: resolution: {integrity: sha512-Q0KSpQYKTF2XWOlAxJO/SRbRhIGAp1GK1spWFbzwv3h0WvfX7pPeA05Y3p0hut7Vcjhdocnx5NduuApF4R1lGQ==} dev: true - /@vue/preload-webpack-plugin/2.0.0_qm2jaalpfx3ptlkhxwihh5vlvu: + /@vue/preload-webpack-plugin/2.0.0_833490016f2df6f9ad47bd9073f6abad: resolution: {integrity: sha512-RoorRB50WehYbsiWu497q8egZBYlrvOo9KBUG41uth4O023Cbs+7POLm9uw2CAiViBAIhvpw1Y4w4i+MZxOfXw==} engines: {node: '>=6.0.0'} peerDependencies: @@ -2963,14 +2963,14 @@ packages: '@xtuc/long': 4.2.2 dev: true - /@webpack-cli/configtest/1.1.1_q7qo2wgeiyigo3znjsjh7f36ue: + /@webpack-cli/configtest/1.1.1_webpack-cli@4.9.2+webpack@5.72.0: resolution: {integrity: sha512-1FBc1f9G4P/AxMqIgfZgeOTuRnwZMten8E7zap5zgpPInnCrP8D4Q81+4CWIch8i/Nf7nXjP0v6CjjbHOrXhKg==} peerDependencies: webpack: 4.x.x || 5.x.x webpack-cli: 4.x.x dependencies: webpack: 5.72.0_webpack-cli@4.9.2 - webpack-cli: 4.9.2_udjrey2ydtzlvw3og7awxsnsq4 + webpack-cli: 4.9.2_a0d31263581cf2badb6e37c16bc9b287 dev: true /@webpack-cli/info/1.4.1_webpack-cli@4.9.2: @@ -2979,10 +2979,10 @@ packages: webpack-cli: 4.x.x dependencies: envinfo: 7.8.1 - webpack-cli: 4.9.2_udjrey2ydtzlvw3og7awxsnsq4 + webpack-cli: 4.9.2_a0d31263581cf2badb6e37c16bc9b287 dev: true - /@webpack-cli/serve/1.6.1_rmt5la42fppytordhdsmrh7kca: + /@webpack-cli/serve/1.6.1_8b27d5839a2bdf89ba2338e4c89fea10: resolution: {integrity: sha512-gNGTiTrjEVQ0OcVnzsRSqTxaBSr+dmTfm+qJsCDluky8uhdLWep7Gcr62QsAKHTMxjCS/8nEITsmFAhfIx+QSw==} peerDependencies: webpack-cli: 4.x.x @@ -2991,8 +2991,8 @@ packages: webpack-dev-server: optional: true dependencies: - webpack-cli: 4.9.2_udjrey2ydtzlvw3og7awxsnsq4 - webpack-dev-server: 4.8.1_q7qo2wgeiyigo3znjsjh7f36ue + webpack-cli: 4.9.2_a0d31263581cf2badb6e37c16bc9b287 + webpack-dev-server: 4.8.1_webpack-cli@4.9.2+webpack@5.72.0 dev: true /@xtuc/ieee754/1.2.0: @@ -4680,7 +4680,7 @@ packages: wrap-ansi: 3.0.1 dev: true - /daisyui/2.14.0_eugea4grn4cvu7egfx7brhhdry: + /daisyui/2.14.0_250c4070d16f055a7c862dfe189ce38e: resolution: {integrity: sha512-M8Pb3iJ1qf0nrIFyBB3SSDlcq+zytsMx5QpVsUx8KerV+ruLOMqyiYY01zmrjjCG5wSKr6Rt8ObO3VXQyArNBA==} peerDependencies: autoprefixer: ^10.0.2 @@ -5423,7 +5423,7 @@ packages: eslint: 8.13.0 dev: true - /eslint-config-standard/17.0.0-0_nd7r54mxqh2lbcgyej5jz57y54: + /eslint-config-standard/17.0.0-0_68ff1ef19781f4b088d8227a9cf7f8ef: resolution: {integrity: sha512-sf9udec8fkLTnH82SmhZQ3E31e4eJaMW09Mt9fbN3OccXFtvSSbGrltpQgGFVooGHoIdiMzDfp6ZNFd+I6Ob+w==} peerDependencies: eslint: ^8.0.1 @@ -5432,7 +5432,7 @@ packages: eslint-plugin-promise: ^6.0.0 dependencies: eslint: 8.13.0 - eslint-plugin-import: 2.26.0_dgzv6anmedwsgjqqjbmjombm7i + eslint-plugin-import: 2.26.0_19b35f01ac20ed232610485897302cfa eslint-plugin-n: 14.0.0_eslint@8.13.0 eslint-plugin-promise: 6.0.0_eslint@8.13.0 dev: true @@ -5446,7 +5446,7 @@ packages: - supports-color dev: true - /eslint-module-utils/2.7.3_dqkeudtgo7g2au7qomz6ni6voe: + /eslint-module-utils/2.7.3_1c144a0e6677cda053f07333e6a3d571: resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==} engines: {node: '>=4'} peerDependencies: @@ -5464,7 +5464,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 5.19.0_jzhokl4shvj5szf5bgr66kln2a + '@typescript-eslint/parser': 5.19.0_eslint@8.13.0+typescript@4.6.3 debug: 3.2.7 eslint-import-resolver-node: 0.3.6 find-up: 2.1.0 @@ -5500,7 +5500,7 @@ packages: htmlparser2: 7.2.0 dev: true - /eslint-plugin-import/2.26.0_dgzv6anmedwsgjqqjbmjombm7i: + /eslint-plugin-import/2.26.0_19b35f01ac20ed232610485897302cfa: resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==} engines: {node: '>=4'} peerDependencies: @@ -5510,14 +5510,14 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 5.19.0_jzhokl4shvj5szf5bgr66kln2a + '@typescript-eslint/parser': 5.19.0_eslint@8.13.0+typescript@4.6.3 array-includes: 3.1.4 array.prototype.flat: 1.3.0 debug: 2.6.9 doctrine: 2.1.0 eslint: 8.13.0 eslint-import-resolver-node: 0.3.6 - eslint-module-utils: 2.7.3_dqkeudtgo7g2au7qomz6ni6voe + eslint-module-utils: 2.7.3_1c144a0e6677cda053f07333e6a3d571 has: 1.0.3 is-core-module: 2.8.1 is-glob: 4.0.3 @@ -5531,7 +5531,7 @@ packages: - supports-color dev: true - /eslint-plugin-jest/26.1.4_pzpgen6zmm2jolojank4cxwjaa: + /eslint-plugin-jest/26.1.4_7e5e6237d96334972dc90355c15ec900: resolution: {integrity: sha512-wgqxujmqc2qpvZqMFWCh6Cniqc8lWpapvXt9j/19DmBDqeDaYhJrSRezYR1SKyemvjx+9e9kny/dgRahraHImA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: @@ -5544,7 +5544,7 @@ packages: jest: optional: true dependencies: - '@typescript-eslint/utils': 5.19.0_jzhokl4shvj5szf5bgr66kln2a + '@typescript-eslint/utils': 5.19.0_eslint@8.13.0+typescript@4.6.3 eslint: 8.13.0 jest: 27.5.1 transitivePeerDependencies: @@ -5580,7 +5580,7 @@ packages: semver: 6.3.0 dev: true - /eslint-plugin-prettier/4.0.0_dak2zfnx7mtmcpd5jcuo55rnb4: + /eslint-plugin-prettier/4.0.0_1815ac95b7fb26c13c7d48a8eef62d0f: resolution: {integrity: sha512-98MqmCJ7vJodoQK359bqQWaxOE0CS8paAz/GgjaZLyex4TTk3g9HugoO89EqWCrFiOqn9EVvcoo7gZzONCWVwQ==} engines: {node: '>=6.0.0'} peerDependencies: @@ -6163,7 +6163,7 @@ packages: is-callable: 1.2.4 dev: true - /fork-ts-checker-webpack-plugin/7.2.4_4dvvomwfbhpgf7xcm7gogbdvgu: + /fork-ts-checker-webpack-plugin/7.2.4_typescript@4.6.3+webpack@5.72.0: resolution: {integrity: sha512-wVN8w0aGiiF4/1o0N5VPeh+PCs4OMg8VzKiYc7Uw7e2VmTt8JuKjEc2/uvd/VfG0Ux+4WnxMncSRcZpXAS6Fyw==} engines: {node: '>=12.13.0', yarn: '>=1.0.0'} peerDependencies: @@ -9530,7 +9530,7 @@ packages: yaml: 1.10.2 dev: true - /postcss-loader/6.2.1_ophkbroklgd6jdvupnp5h6xq4i: + /postcss-loader/6.2.1_postcss@8.4.12+webpack@5.72.0: resolution: {integrity: sha512-WbbYpmAaKcux/P66bZ40bpWsBucjx/TTgVVzRZ9yUO8yQfVBlameJ0ZGVaPfH64hNSBh63a+ICP5nqOpBA0w+Q==} engines: {node: '>= 12.13.0'} peerDependencies: @@ -10284,7 +10284,7 @@ packages: resolution: {integrity: sha512-yUcBYdBBbo3QiPsgYDcfQcIkGZHfxOaoE6HLSnr1sPzMhdyxusbfKOSUbSd/ocGi32dxcj366PsTj+5oggeKKw==} dev: true - /react-redux/7.2.8_zpnidt7m3osuk7shl3s4oenomq: + /react-redux/7.2.8_react-dom@18.0.0+react@18.0.0: resolution: {integrity: sha512-6+uDjhs3PSIclqoCk0kd6iX74gzrGc3W5zcAjbrFgEdIjRSQObdIwfx80unTkVUYvbQ95Y8Av3OvFHq1w5EOUw==} peerDependencies: react: ^16.8.3 || ^17 || ^18 @@ -10311,7 +10311,7 @@ packages: engines: {node: '>=0.10.0'} dev: true - /react-router-dom/6.3.0_zpnidt7m3osuk7shl3s4oenomq: + /react-router-dom/6.3.0_react-dom@18.0.0+react@18.0.0: resolution: {integrity: sha512-uaJj7LKytRxZNQV8+RbzJWnJ8K2nPsOOEuX7aQstlMZKQT0164C+X2w6bnkqU3sjtLvpd5ojrezAyfZ1+0sStw==} peerDependencies: react: '>=16.8' @@ -11517,7 +11517,7 @@ packages: yargs: 4.7.1 dev: true - /stylus-loader/6.2.0_u75fwzlywerfxxt2up7yjpiu5i: + /stylus-loader/6.2.0_stylus@0.57.0+webpack@5.72.0: resolution: {integrity: sha512-5dsDc7qVQGRoc6pvCL20eYgRUxepZ9FpeK28XhdXaIPP6kXr6nI1zAAKFQgP5OBkOfKaURp4WUpJzspg1f01Gg==} engines: {node: '>= 12.13.0'} peerDependencies: @@ -11850,7 +11850,7 @@ packages: typescript: 4.6.3 dev: true - /ts-jest/27.1.4_dj5cswed7rznuujbynhmi4x2bq: + /ts-jest/27.1.4_1a7a295883fc72da5121c34ec472fa0c: resolution: {integrity: sha512-qjkZlVPWVctAezwsOD1OPzbZ+k7zA5z3oxII4dGdZo5ggX/PL7kvwTM0pXTr10fAtbiVpJaL3bWd502zAhpgSQ==} engines: {node: ^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0} hasBin: true @@ -12312,7 +12312,7 @@ packages: - utf-8-validate dev: true - /webpack-cli/4.9.2_udjrey2ydtzlvw3og7awxsnsq4: + /webpack-cli/4.9.2_a0d31263581cf2badb6e37c16bc9b287: resolution: {integrity: sha512-m3/AACnBBzK/kMTcxWHcZFPrw/eQuY4Df1TxvIWfWM2x7mRqBQCqKEd96oCUa9jkapLBaFfRce33eGDb4Pr7YQ==} engines: {node: '>=10.13.0'} hasBin: true @@ -12333,9 +12333,9 @@ packages: optional: true dependencies: '@discoveryjs/json-ext': 0.5.7 - '@webpack-cli/configtest': 1.1.1_q7qo2wgeiyigo3znjsjh7f36ue + '@webpack-cli/configtest': 1.1.1_webpack-cli@4.9.2+webpack@5.72.0 '@webpack-cli/info': 1.4.1_webpack-cli@4.9.2 - '@webpack-cli/serve': 1.6.1_rmt5la42fppytordhdsmrh7kca + '@webpack-cli/serve': 1.6.1_8b27d5839a2bdf89ba2338e4c89fea10 colorette: 2.0.16 commander: 7.2.0 execa: 5.1.1 @@ -12345,7 +12345,7 @@ packages: rechoir: 0.7.1 webpack: 5.72.0_webpack-cli@4.9.2 webpack-bundle-analyzer: 4.5.0 - webpack-dev-server: 4.8.1_q7qo2wgeiyigo3znjsjh7f36ue + webpack-dev-server: 4.8.1_webpack-cli@4.9.2+webpack@5.72.0 webpack-merge: 5.8.0 dev: true @@ -12363,7 +12363,7 @@ packages: webpack: 5.72.0_webpack-cli@4.9.2 dev: true - /webpack-dev-server/4.8.1_q7qo2wgeiyigo3znjsjh7f36ue: + /webpack-dev-server/4.8.1_webpack-cli@4.9.2+webpack@5.72.0: resolution: {integrity: sha512-dwld70gkgNJa33czmcj/PlKY/nOy/BimbrgZRaR9vDATBQAYgLzggR0nxDtPLJiLrMgZwbE6RRfJ5vnBBasTyg==} engines: {node: '>= 12.13.0'} hasBin: true @@ -12402,7 +12402,7 @@ packages: sockjs: 0.3.24 spdy: 4.0.2 webpack: 5.72.0_webpack-cli@4.9.2 - webpack-cli: 4.9.2_udjrey2ydtzlvw3og7awxsnsq4 + webpack-cli: 4.9.2_a0d31263581cf2badb6e37c16bc9b287 webpack-dev-middleware: 5.3.1_webpack@5.72.0 ws: 8.5.0 transitivePeerDependencies: @@ -12466,7 +12466,7 @@ packages: tapable: 2.2.1 terser-webpack-plugin: 5.3.1_webpack@5.72.0 watchpack: 2.3.1 - webpack-cli: 4.9.2_udjrey2ydtzlvw3og7awxsnsq4 + webpack-cli: 4.9.2_a0d31263581cf2badb6e37c16bc9b287 webpack-sources: 3.2.3 transitivePeerDependencies: - '@swc/core' From f52e5e4b6ea4657477c475d17a6a98c7da3a0410 Mon Sep 17 00:00:00 2001 From: JiangWeixian Date: Wed, 22 Jun 2022 21:48:53 +0800 Subject: [PATCH 2/5] :bug: polyfill webpack-env with esbuild-loader --- src/App.tsx | 2 +- src/utils/webpack-env.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 src/utils/webpack-env.js diff --git a/src/App.tsx b/src/App.tsx index 309ab0f..f23cc81 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,7 +1,7 @@ import React, { useCallback, useState } from 'react' + import RouterViewer from '@/routes' import { DarkIcon, LightIcon } from '@/components/Icons' - import './App.css' const App = () => { diff --git a/src/utils/webpack-env.js b/src/utils/webpack-env.js new file mode 100644 index 0000000..a8d2fcb --- /dev/null +++ b/src/utils/webpack-env.js @@ -0,0 +1,5 @@ +export const contextRequire = import.meta.webpackContext('..', { + recursive: true, + regExp: /.tsx/, + mode: 'sync', +}) From ab57bdad6b6961c271752d86de990f23e0a34950 Mon Sep 17 00:00:00 2001 From: JiangWeixian Date: Wed, 22 Jun 2022 22:29:29 +0800 Subject: [PATCH 3/5] :bug: css-loader options --- build/webpack.common.config.js | 2 +- build/webpack.prod.config.js | 7 ++++--- src/utils/webpack-env.js | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build/webpack.common.config.js b/build/webpack.common.config.js index 21dd612..b1bfcec 100755 --- a/build/webpack.common.config.js +++ b/build/webpack.common.config.js @@ -31,7 +31,7 @@ const common = { loader: 'esbuild-loader', options: { loader: 'tsx', - target: 'es2015', + target: 'es2017', }, }, ], diff --git a/build/webpack.prod.config.js b/build/webpack.prod.config.js index d7da59c..99a1875 100644 --- a/build/webpack.prod.config.js +++ b/build/webpack.prod.config.js @@ -54,7 +54,7 @@ const prod = { terserOptions: { warnings: false, compress: { - drop_console: true, + drop_console: false, }, }, }), @@ -89,8 +89,9 @@ const prod = { loader: 'css-loader', options: { sourceMap: true, - modules: true, - localIdentName: '[name]_[local]___[hash:base64:5]', + modules: { + localIdentName: '[name]_[local]___[hash:base64:5]', + }, }, }, { loader: 'postcss-loader', options: { sourceMap: true } }, diff --git a/src/utils/webpack-env.js b/src/utils/webpack-env.js index a8d2fcb..09bbb2f 100644 --- a/src/utils/webpack-env.js +++ b/src/utils/webpack-env.js @@ -1,3 +1,4 @@ +// refs: https://webpack.js.org/api/module-variables/#importmetawebpackcontext export const contextRequire = import.meta.webpackContext('..', { recursive: true, regExp: /.tsx/, From f51282f99d41f9e1c798e49c87a464ce0ac9967b Mon Sep 17 00:00:00 2001 From: JiangWeixian Date: Wed, 22 Jun 2022 22:31:35 +0800 Subject: [PATCH 4/5] :bulb: es2017 https://web.dev/publish-modern-javascript/ --- build/webpack.common.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/webpack.common.config.js b/build/webpack.common.config.js index b1bfcec..2587cb7 100755 --- a/build/webpack.common.config.js +++ b/build/webpack.common.config.js @@ -31,6 +31,8 @@ const common = { loader: 'esbuild-loader', options: { loader: 'tsx', + // according to https://web.dev/publish-modern-javascript/ + // es2017 support 95% browsers target: 'es2017', }, }, From e0ab00d807b84d7b0aca4f029323e7ff7ae857c1 Mon Sep 17 00:00:00 2001 From: JiangWeixian Date: Wed, 22 Jun 2022 22:40:48 +0800 Subject: [PATCH 5/5] :pencil: why utils/webpack-env --- .changeset/fuzzy-garlics-develop.md | 5 +++++ README.md | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 .changeset/fuzzy-garlics-develop.md diff --git a/.changeset/fuzzy-garlics-develop.md b/.changeset/fuzzy-garlics-develop.md new file mode 100644 index 0000000..22ed701 --- /dev/null +++ b/.changeset/fuzzy-garlics-develop.md @@ -0,0 +1,5 @@ +--- +"@aiou/react-template": patch +--- + +import.meta in webpack with esbuild-loader diff --git a/README.md b/README.md index 51a69a8..567d3f6 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,10 @@ - **Setup** - `pnpm * pnpm dev` - **Build** - `pnpm build` +## known issues + +- [#12 - `import.meta` with `esbuild-loader`](https://github.com/neo-hack/react-template/issues/12) + ## refs - https://stackoverflow.com/questions/35412137/how-to-get-access-to-webpack-dev-server-from-devices-in-local-network \ No newline at end of file