Skip to content

Commit e7ef6c8

Browse files
committed
chore: reduce package size
1 parent 5ab0b99 commit e7ef6c8

File tree

5 files changed

+15
-5
lines changed

5 files changed

+15
-5
lines changed

build.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async function runWebpack(isWithoutKatex, isWithoutTiktoken, callback) {
4141
'i18next',
4242
'react-i18next',
4343
'./src/utils',
44-
'./src/_locales/i18n',
44+
'./src/_locales/i18n-react',
4545
],
4646
},
4747
output: {

src/_locales/i18n-react.mjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import i18n from 'i18next'
2+
import { initReactI18next } from 'react-i18next'
3+
import { resources } from './resources'
4+
5+
i18n.use(initReactI18next).init({
6+
resources,
7+
fallbackLng: 'en',
8+
interpolation: {
9+
escapeValue: false, // not needed for react as it escapes by default
10+
},
11+
})

src/_locales/i18n.mjs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import i18n from 'i18next'
2-
import { initReactI18next } from 'react-i18next'
32
import { resources } from './resources'
43

5-
i18n.use(initReactI18next).init({
4+
i18n.init({
65
resources,
76
fallbackLng: 'en',
87
interpolation: {

src/content-script/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
import FloatingToolbar from '../components/FloatingToolbar'
2323
import Browser from 'webextension-polyfill'
2424
import { getPreferredLanguage } from '../config/language.mjs'
25-
import '../_locales/i18n'
25+
import '../_locales/i18n-react'
2626
import { changeLanguage } from 'i18next'
2727

2828
/**

src/popup/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { render } from 'preact'
22
import Popup from './Popup'
3-
import '../_locales/i18n'
3+
import '../_locales/i18n-react'
44

55
render(<Popup />, document.getElementById('app'))

0 commit comments

Comments
 (0)