-
-
Notifications
You must be signed in to change notification settings - Fork 246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate Toolpad Core in Toolpad Studio runtime #4119
base: master
Are you sure you want to change the base?
Conversation
@@ -270,6 +270,14 @@ if (import.meta.hot) { | |||
: // load compiled | |||
path.resolve(currentDirectory, '../exports'), | |||
}, | |||
{ | |||
find: '@toolpad/core', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to add an alias here to get @toolpad/core
imports to work in Studio, not sure why it's not needed for @toolpad/studio-components
for example, as those just worked?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pnpm installs the core build
folder into studio node modules because of its package.json publishConfig.directory
setting. During the core build command a package.json is generated in that build folder. the build folder is what gets published on npm.
The dev command of builds the sources into the build folder, but it doesn't copy the package.json. That's why module resolution doesn't work. You made it work by alisaing to the core main folder, which does have a package.json.
I added some commits that just call the copy command in the dev command. It's not perfect, it won't watch for changes to package.json, but at least it unblocks us in the PR.
This horizontal scrolling is something to investigate: Screen.Recording.2024-09-20.at.10.26.48.mov |
Yeah still fixing a few things. |
return [ | ||
`import { ${name} } from '@toolpad/core/${name}';${ | ||
hasNextJsVersion | ||
? `\nimport { ${name} } from '@toolpad/core/nextjs/${name}'; // Next.js` | ||
: '' | ||
}${ | ||
hasReactRouterDOMVersion | ||
? `\nimport { ${name} } from '@toolpad/core/react-router-dom/${name}'; // react-router-dom` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't support imports deeper than one level. This must be
import { AppProvider } from '@toolpad/core/react-router-dom'
cc @bharatkashyap same for nextjs
Closes #4060
react-router-dom/AppProvider
as it seems like it will be popular, but we can adjust it moresx
prop toDashboardLayout
Missing:
react-router-dom/AppProvider
if we include itsession
works well, haven't tried with authentication yet