mirror of
https://github.com/strapi/strapi.git
synced 2025-06-27 00:41:25 +00:00
chore: apply feedback, improve warnings
This commit is contained in:
parent
4bd7b4e8f5
commit
6b93a97ac7
4
nx.json
4
nx.json
@ -2,6 +2,7 @@
|
||||
"namedInputs": {
|
||||
"default": ["{projectRoot}/**/*"],
|
||||
"production": [
|
||||
"{workspaceRoot}/rollup.utils.mjs",
|
||||
"!{projectRoot}/**/*.test.ts",
|
||||
"!{projectRoot}/**/*.test.js",
|
||||
"!{projectRoot}/**/*.test.api.js",
|
||||
@ -12,8 +13,7 @@
|
||||
"!{projectRoot}/jest.config.front.js",
|
||||
"!{projectRoot}/tsconfig.eslint.json",
|
||||
"!{projectRoot}/.eslintignore",
|
||||
"!{projectRoot}/.eslintrc.js",
|
||||
"!{projectRoot}/rollup.config.mjs"
|
||||
"!{projectRoot}/.eslintrc.js"
|
||||
]
|
||||
},
|
||||
"cli": {
|
||||
|
@ -330,8 +330,6 @@ class StrapiApp {
|
||||
try {
|
||||
const { default: data } = await import(`./translations/${locale}.js`);
|
||||
|
||||
console.log(data);
|
||||
|
||||
return { data, locale };
|
||||
} catch {
|
||||
try {
|
||||
|
@ -1,11 +1,7 @@
|
||||
import { lazy } from 'react';
|
||||
|
||||
import { Page } from '../../../../components/PageHelpers';
|
||||
import { useTypedSelector } from '../../../../core/store/hooks';
|
||||
|
||||
// import { EditPage } from './EditPage';
|
||||
|
||||
const EditPage = lazy(() => import('./EditPage').then((module) => ({ default: module.EditPage })));
|
||||
import { EditPage } from './EditPage';
|
||||
|
||||
const ProtectedCreatePage = () => {
|
||||
const permissions = useTypedSelector(
|
||||
|
@ -22,13 +22,5 @@ export default defineConfig([
|
||||
test: './admin/tests/index.ts',
|
||||
},
|
||||
outDir: './dist/admin',
|
||||
onwarn(warning, warn) {
|
||||
// Suppress the "default is never used" warning for React
|
||||
if (warning.code === 'UNUSED_EXTERNAL_IMPORT' && warning.exporter === 'react') {
|
||||
return;
|
||||
}
|
||||
|
||||
warn(warning); // Log other warnings
|
||||
},
|
||||
}),
|
||||
]);
|
||||
|
@ -42,6 +42,14 @@ const basePlugins = () => [
|
||||
dynamicImportVars({}),
|
||||
];
|
||||
|
||||
const isInput = (id, input) => {
|
||||
if (typeof input === 'string') {
|
||||
return id.includes(path.resolve(input));
|
||||
}
|
||||
|
||||
return Object.values(input).some((i) => id.includes(path.resolve(i)));
|
||||
};
|
||||
|
||||
const baseConfig = (opts = {}) => {
|
||||
const { rootDir, outDir = './dist', input = './src/index.ts', ...rest } = opts;
|
||||
|
||||
@ -50,6 +58,25 @@ const baseConfig = (opts = {}) => {
|
||||
external: isExernal,
|
||||
output: baseOutput({ outDir, rootDir }),
|
||||
plugins: basePlugins(),
|
||||
onwarn(warning, warn) {
|
||||
if (warning.code === 'MIXED_EXPORTS') {
|
||||
// json files are always mixed exports
|
||||
if (warning?.id?.endsWith('.json')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// we only care about mixed exports in our input files
|
||||
if (warning.id && !isInput(warning.id, input)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (warning.code === 'UNUSED_EXTERNAL_IMPORT' && warning.exporter === 'react') {
|
||||
return;
|
||||
}
|
||||
|
||||
warn(warning);
|
||||
},
|
||||
...rest,
|
||||
});
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user