mirror of
https://github.com/strapi/strapi.git
synced 2025-08-20 22:59:11 +00:00
fix(admin): load app custom with jsx and allow more extensions
This commit is contained in:
parent
ecfbf5ede6
commit
8ac0ef5c42
@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"jsx": "react",
|
||||||
"moduleResolution": "nodenext",
|
"moduleResolution": "nodenext",
|
||||||
"target": "ES2021",
|
"target": "ES2021",
|
||||||
"checkJs": true,
|
"checkJs": true,
|
||||||
|
@ -1,8 +1,18 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { Button } from '@strapi/design-system';
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
locales: ['it', 'es', 'en'],
|
locales: ['it', 'es', 'en'],
|
||||||
};
|
};
|
||||||
const bootstrap = () => {
|
const bootstrap = (app) => {
|
||||||
console.log('I AM BOOTSTRAPPED');
|
console.log('I AM BOOTSTRAPPED');
|
||||||
|
|
||||||
|
app.injectContentManagerComponent('editView', 'right-links', {
|
||||||
|
name: 'PreviewButton',
|
||||||
|
Component: () => (
|
||||||
|
<Button onClick={() => window.alert('Not here, The preview is.')}>Preview</Button>
|
||||||
|
),
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
@ -18,7 +18,11 @@ const pathExists = async (path: string) => {
|
|||||||
*/
|
*/
|
||||||
const loadFile = async (path: string): Promise<undefined | any> => {
|
const loadFile = async (path: string): Promise<undefined | any> => {
|
||||||
if (await pathExists(path)) {
|
if (await pathExists(path)) {
|
||||||
const esbuildOptions = { extensions: ['.js', '.mjs', '.ts'] };
|
const esbuildOptions: Parameters<typeof register>[0] = {
|
||||||
|
extensions: ['.js', '.mjs', '.ts', '.jsx', '.tsx'],
|
||||||
|
jsx: 'automatic',
|
||||||
|
loader: 'jsx',
|
||||||
|
};
|
||||||
|
|
||||||
const { unregister } = register(esbuildOptions);
|
const { unregister } = register(esbuildOptions);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user