Skip to content

Commit f01ed09

Browse files
committed
feat: add bundlesize plugin
1 parent af41d7e commit f01ed09

File tree

6 files changed

+47
-9
lines changed

6 files changed

+47
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@ dist-ssr
2222
*.njsproj
2323
*.sln
2424
*.sw?
25+
bundlemeta.json

lingui.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { defineConfig } from '@lingui/cli';
33
export default defineConfig({
44
catalogs: [
55
{
6+
exclude: ['src/components/trans/trans.tsx'],
67
include: ['src'],
78
path: '<rootDir>/src/locales/{locale}/messages',
89
},

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@
9797
"ts-node": "^10.9.2",
9898
"typescript": "^5.7.2",
9999
"typescript-eslint": "^8.18.2",
100-
"vite": "^6.0.5"
100+
"vite": "^6.0.5",
101+
"vite-plugin-bundlesize": "^0.1.0"
101102
},
102103
"lint-staged": {
103104
"*.{js,jsx,ts,tsx}": [

src/locales/en/messages.po

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,19 @@ msgstr ""
1616
#. js-lingui-explicit-id
1717
#: src/App.tsx:16
1818
#: src/App.tsx:19
19-
msgid "tgb"
20-
msgstr "Edit <0>src/App.tsx</0> and save to test HMR"
19+
#~ msgid "tgb"
20+
#~ msgstr "Edit <0>src/App.tsx</0> and save to test HMR"
2121

2222
#. js-lingui-explicit-id
2323
#: src/App.tsx:25
2424
#: src/App.tsx:31
25-
msgid "test"
26-
msgstr "New Trans to test watcher!"
25+
#~ msgid "test"
26+
#~ msgstr "New Trans to test watcher!"
2727

2828
#: src/App.tsx:28
29-
msgid "Another New Trans to test watcher!"
30-
msgstr "Another New Trans to test watcher!"
29+
#~ msgid "Another New Trans to test watcher!"
30+
#~ msgstr "Another New Trans to test watcher!"
3131

3232
#: src/App.tsx:25
33-
msgid "New Trans to test watcher!"
34-
msgstr "New Trans to test watcher!"
33+
#~ msgid "New Trans to test watcher!"
34+
#~ msgstr "New Trans to test watcher!"

vite.config.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,34 @@ import { lingui } from '@lingui/vite-plugin';
22
import react from '@vitejs/plugin-react-swc';
33
import path from 'path';
44
import { defineConfig } from 'vite';
5+
import bundlesize from 'vite-plugin-bundlesize';
56

67
// https://vite.dev/config/
78
export default defineConfig({
9+
build: {
10+
sourcemap: 'hidden',
11+
target: 'esnext',
12+
},
13+
css: {
14+
preprocessorOptions: {
15+
scss: {
16+
api: 'modern-compiler',
17+
},
18+
},
19+
},
820
plugins: [
921
react({
1022
plugins: [['@lingui/swc-plugin', {}]],
1123
}),
24+
bundlesize({
25+
limits: [
26+
{
27+
limit: Infinity,
28+
name: '**/*',
29+
},
30+
],
31+
stats: 'all',
32+
}),
1233
lingui(),
1334
],
1435
resolve: {

yarn.lock

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8644,6 +8644,15 @@ varint@^6.0.0:
86448644
resolved "https://registry.yarnpkg.com/varint/-/varint-6.0.0.tgz#9881eb0ce8feaea6512439d19ddf84bf551661d0"
86458645
integrity sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg==
86468646

8647+
vite-plugin-bundlesize@^0.1.0:
8648+
version "0.1.0"
8649+
resolved "https://registry.yarnpkg.com/vite-plugin-bundlesize/-/vite-plugin-bundlesize-0.1.0.tgz#2c3c6bfa908d1a43ae6f428826af07abbaa558f7"
8650+
integrity sha512-aaoVAijpSg7yFzveOX+KWul6QPk0YmuugGacSA4bnpErxoyXHAkGi02AEzx1qyt5AKMN8LG7bDLsYLW8mq2QUQ==
8651+
dependencies:
8652+
picomatch "^4.0.2"
8653+
strip-ansi "^7.1.0"
8654+
vlq "^2.0.4"
8655+
86478656
vite@^6.0.5:
86488657
version "6.0.5"
86498658
resolved "https://registry.yarnpkg.com/vite/-/vite-6.0.5.tgz#1d0fbdb3ffe61e944089abeddb7d2c509420acfd"
@@ -8655,6 +8664,11 @@ vite@^6.0.5:
86558664
optionalDependencies:
86568665
fsevents "~2.3.3"
86578666

8667+
vlq@^2.0.4:
8668+
version "2.0.4"
8669+
resolved "https://registry.yarnpkg.com/vlq/-/vlq-2.0.4.tgz#6057b85729245b9829e3cc7755f95b228d4fe041"
8670+
integrity sha512-aodjPa2wPQFkra1G8CzJBTHXhgk3EVSwxSWXNPr1fgdFLUb8kvLV1iEb6rFgasIsjP82HWI6dsb5Io26DDnasA==
8671+
86588672
vscode-json-languageservice@^4.1.6:
86598673
version "4.2.1"
86608674
resolved "https://registry.yarnpkg.com/vscode-json-languageservice/-/vscode-json-languageservice-4.2.1.tgz#94b6f471ece193bf4a1ef37f6ab5cce86d50a8b4"

0 commit comments

Comments
 (0)