2022-03-02 18:10:42 +03:00
|
|
|
/* eslint-env node */
|
|
|
|
|
|
|
|
import commonjs from '@rollup/plugin-commonjs';
|
|
|
|
import json from '@rollup/plugin-json';
|
2023-02-15 18:21:20 +03:00
|
|
|
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
2022-03-02 18:10:42 +03:00
|
|
|
import replace from '@rollup/plugin-replace';
|
|
|
|
import typescript from '@rollup/plugin-typescript';
|
|
|
|
import css from 'rollup-plugin-css-only';
|
|
|
|
|
|
|
|
/** @type {import('rollup').RollupOptions} */
|
|
|
|
const config = {
|
|
|
|
input: 'src/index.tsx',
|
2023-06-22 11:43:16 +03:00
|
|
|
output: { file: 'dist/translate.js' },
|
2022-03-02 18:10:42 +03:00
|
|
|
|
|
|
|
treeshake: 'recommended',
|
|
|
|
|
|
|
|
plugins: [
|
|
|
|
json(),
|
|
|
|
typescript(),
|
|
|
|
replace({
|
|
|
|
preventAssignment: true,
|
|
|
|
'process.env.NODE_ENV': JSON.stringify(
|
|
|
|
process.env.BUILD ?? 'development',
|
|
|
|
),
|
|
|
|
}),
|
2023-02-15 18:21:20 +03:00
|
|
|
nodeResolve(),
|
2022-03-02 18:10:42 +03:00
|
|
|
commonjs(),
|
|
|
|
css({ output: 'translate.css' }),
|
|
|
|
],
|
|
|
|
|
|
|
|
onwarn(warning, warn) {
|
|
|
|
// https://github.com/reduxjs/redux-toolkit/issues/1466
|
|
|
|
if (warning.id?.includes('@reduxjs/toolkit')) {
|
|
|
|
switch (warning.code) {
|
|
|
|
case 'SOURCEMAP_ERROR':
|
|
|
|
return;
|
|
|
|
case 'THIS_IS_UNDEFINED':
|
2022-04-25 18:16:01 +03:00
|
|
|
if (warning.frame?.includes('this && this')) {
|
|
|
|
return;
|
|
|
|
}
|
2022-03-02 18:10:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
warn(warning);
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2022-05-12 20:08:18 +03:00
|
|
|
// eslint-disable-next-line import/no-default-export
|
2022-03-02 18:10:42 +03:00
|
|
|
export default config;
|