mirror of
https://github.com/strapi/strapi.git
synced 2025-11-01 10:23:34 +00:00
Merge pull request #10413 from strapi/core/load-internal-plugins
Load internal plugins
This commit is contained in:
commit
db23b58329
@ -23,13 +23,37 @@ import Logout from './Logout';
|
||||
import Wrapper from './Wrapper';
|
||||
import Content from './Content';
|
||||
|
||||
const HomePage = lazy(() => import('../HomePage'));
|
||||
const InstalledPluginsPage = lazy(() => import('../InstalledPluginsPage'));
|
||||
const MarketplacePage = lazy(() => import('../MarketplacePage'));
|
||||
const HomePage = lazy(() => import(/* webpackChunkName: "Admin_homePage" */ '../HomePage'));
|
||||
const InstalledPluginsPage = lazy(() =>
|
||||
import(/* webpackChunkName: "Admin_pluginsPage" */ '../InstalledPluginsPage')
|
||||
);
|
||||
const MarketplacePage = lazy(() =>
|
||||
import(/* webpackChunkName: "Admin_marketplace" */ '../MarketplacePage')
|
||||
);
|
||||
const NotFoundPage = lazy(() => import('../NotFoundPage'));
|
||||
const PluginDispatcher = lazy(() => import('../PluginDispatcher'));
|
||||
const ProfilePage = lazy(() => import('../ProfilePage'));
|
||||
const SettingsPage = lazy(() => import('../SettingsPage'));
|
||||
const PluginDispatcher = lazy(() =>
|
||||
import(/* webpackChunkName: "Admin_pluginDispatcher" */ '../PluginDispatcher')
|
||||
);
|
||||
const ProfilePage = lazy(() =>
|
||||
import(/* webpackChunkName: "Admin_profilePage" */ '../ProfilePage')
|
||||
);
|
||||
const SettingsPage = lazy(() =>
|
||||
import(/* webpackChunkName: "Admin_settingsPage" */ '../SettingsPage')
|
||||
);
|
||||
// These are internal plugins
|
||||
const CM = lazy(() =>
|
||||
import(
|
||||
/* webpackChunkName: "content-manager" */ '@strapi/plugin-content-manager/admin/src/pages/Main'
|
||||
)
|
||||
);
|
||||
const CTB = lazy(() =>
|
||||
import(
|
||||
/* webpackChunkName: "content-type-builder" */ '@strapi/plugin-content-type-builder/admin/src/pages/App'
|
||||
)
|
||||
);
|
||||
const Upload = lazy(() =>
|
||||
import(/* webpackChunkName: "upload" */ '@strapi/plugin-upload/admin/src/pages/App')
|
||||
);
|
||||
|
||||
// Simple hook easier for testing
|
||||
const useTrackUsage = () => {
|
||||
@ -68,6 +92,9 @@ const Admin = () => {
|
||||
<Switch>
|
||||
<Route path="/" component={HomePage} exact />
|
||||
<Route path="/me" component={ProfilePage} exact />
|
||||
<Route path="/plugins/content-manager" component={CM} />
|
||||
<Route path="/plugins/content-type-builder" component={CTB} />
|
||||
<Route path="/plugins/upload" component={Upload} />
|
||||
<Route path="/plugins/:pluginId" component={PluginDispatcher} />
|
||||
<Route path="/settings/:settingId" component={SettingsPage} />
|
||||
<Route path="/settings" component={SettingsPage} exact />
|
||||
|
||||
@ -21,7 +21,10 @@ import { Content, Wrapper } from './components';
|
||||
import routes from './utils/routes';
|
||||
import { makeUniqueRoutes, createRoute } from '../SettingsPage/utils';
|
||||
|
||||
const AuthenticatedApp = lazy(() => import('../../components/AuthenticatedApp'));
|
||||
const AuthenticatedApp = lazy(() =>
|
||||
import(/* webpackChunkName: "Admin-authenticatedApp" */ '../../components/AuthenticatedApp')
|
||||
);
|
||||
|
||||
function App() {
|
||||
const toggleNotification = useNotification();
|
||||
const [{ isLoading, hasAdmin, uuid }, setState] = useState({ isLoading: true, hasAdmin: false });
|
||||
|
||||
@ -91,7 +91,8 @@ module.exports = ({
|
||||
rules: [
|
||||
{
|
||||
test: /\.m?js$/,
|
||||
exclude: /node_modules/,
|
||||
// TODO remove when plugins are built separately
|
||||
exclude: /node_modules\/(?!(@strapi\/plugin-content-manager|@strapi\/plugin-content-type-builder|@strapi\/plugin-upload)\/).*/,
|
||||
use: {
|
||||
loader: require.resolve('babel-loader'),
|
||||
options: {
|
||||
@ -119,6 +120,7 @@ module.exports = ({
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
test: /\.css$/i,
|
||||
use: ['style-loader', 'css-loader'],
|
||||
|
||||
@ -8,7 +8,6 @@
|
||||
import pluginPkg from '../../package.json';
|
||||
import pluginId from './pluginId';
|
||||
import pluginLogo from './assets/images/logo.svg';
|
||||
import App from './pages/Main';
|
||||
import reducers from './reducers';
|
||||
import trads from './translations';
|
||||
|
||||
@ -30,7 +29,6 @@ export default {
|
||||
},
|
||||
isReady: true,
|
||||
isRequired: pluginPkg.strapi.required || false,
|
||||
mainComponent: App,
|
||||
name,
|
||||
pluginLogo,
|
||||
trads,
|
||||
|
||||
@ -7,7 +7,6 @@
|
||||
|
||||
import pluginPkg from '../../package.json';
|
||||
import pluginLogo from './assets/images/logo.svg';
|
||||
import App from './pages/App';
|
||||
import trads from './translations';
|
||||
import pluginPermissions from './permissions';
|
||||
import pluginId from './pluginId';
|
||||
@ -27,7 +26,6 @@ export default {
|
||||
id: pluginId,
|
||||
isRequired: pluginPkg.strapi.required || false,
|
||||
isReady: true,
|
||||
mainComponent: App,
|
||||
name,
|
||||
pluginLogo,
|
||||
trads,
|
||||
|
||||
@ -12,7 +12,6 @@ import pluginPermissions from './permissions';
|
||||
import Initializer from './components/Initializer';
|
||||
import InputMedia from './components/InputMedia';
|
||||
import InputModalStepper from './components/InputModalStepper';
|
||||
import App from './pages/App';
|
||||
import SettingsPage from './pages/SettingsPage';
|
||||
import reducers from './reducers';
|
||||
import trads from './translations';
|
||||
@ -40,8 +39,6 @@ export default {
|
||||
|
||||
isReady: false,
|
||||
isRequired: pluginPkg.strapi.required || false,
|
||||
|
||||
mainComponent: App,
|
||||
name,
|
||||
pluginLogo,
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user