Skip to content

Commit

Permalink
Build updates (#1769)
Browse files Browse the repository at this point in the history
  • Loading branch information
VIKTORVAV99 authored Jul 16, 2024
1 parent 34aa20d commit 08ba6ae
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
"format": "prettier \"{,**/}*.{ts,tsx,mts,js,json,md}\" --check",
"format:fix": "prettier \"{,**/}*.{ts,tsx,mts,js,json,md}\" --write",
"copy": "cp-cli ./dist/umd/react-i18next.min.js ./react-i18next.min.js && cp-cli ./dist/umd/react-i18next.js ./react-i18next.js && echo '{\"type\":\"module\"}' > dist/es/package.json",
"build:es": "cross-env BABEL_ENV=jsnext babel src --out-dir dist/es",
"build:es": "cross-env BABEL_ENV=ESNext babel src --out-dir dist/es",
"build:cjs": "babel src --out-dir dist/commonjs",
"build:umd": "rollup -c rollup.config.mjs --format umd && rollup -c rollup.config.mjs --format umd --uglify",
"build:amd": "rollup -c rollup.config.mjs --format amd && rollup -c rollup.config.mjs --format amd --uglify",
Expand Down
5 changes: 2 additions & 3 deletions src/Translation.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { useTranslation } from './useTranslation.js';

export function Translation(props) {
const { ns, children, ...options } = props;
export const Translation = ({ ns, children, ...options }) => {
const [t, i18n, ready] = useTranslation(ns, options);

return children(
Expand All @@ -12,4 +11,4 @@ export function Translation(props) {
},
ready,
);
}
};
12 changes: 5 additions & 7 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
// Do not use arrow function here as it will break optimizations of arguments
export function warn(...args) {
export const warn = (...args) => {
if (console && console.warn) {
if (isString(args[0])) args[0] = `react-i18next:: ${args[0]}`;
console.warn(...args);
}
}
};

const alreadyWarned = {};
// Do not use arrow function here as it will break optimizations of arguments
export function warnOnce(...args) {
export const warnOnce = (...args) => {
if (isString(args[0]) && alreadyWarned[args[0]]) return;
if (isString(args[0])) alreadyWarned[args[0]] = new Date();
warn(...args);
}
};

// not needed right now
//
// export function deprecated(...args) {
// export const deprecated = (...args) => {
// if (process && process.env && (!process.env.NODE_ENV || process.env.NODE_ENV === 'development')) {
// if (isString(args[0])) args[0] = `deprecation warning -> ${args[0]}`;
// warnOnce(...args);
Expand Down
8 changes: 4 additions & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"exclude": ["example/**/*"],

"compilerOptions": {
"module": "commonjs",
"target": "es5",
"lib": ["es6", "dom"],
"module": "ESNext",
"target": "ES2020",
"lib": ["ES2020", "dom"],
"jsx": "react",
"moduleResolution": "node",
"moduleResolution": "bundler",
"forceConsistentCasingInFileNames": true,
"strict": true,
"noEmit": true,
Expand Down

0 comments on commit 08ba6ae

Please sign in to comment.