Skip to content
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

[vite] Allow package authors to specify packages to include in vite #172

Merged
merged 1 commit into from
Jul 10, 2024

Conversation

brijeshb42
Copy link
Contributor

optimization during dev mode.

This PR includes a new vite plugin that checks for the existense of pigment-css key in packages' package.json and updates the vite config as specified there.

@brijeshb42 brijeshb42 added the vite label Jul 9, 2024
@brijeshb42 brijeshb42 force-pushed the vite-meta branch 3 times, most recently from ee1e20c to e96284a Compare July 9, 2024 08:57
@siriwatknp
Copy link
Member

What's this PR solve?

I tried the csb but still run into errors if not specify optimizeDeps:

export default defineConfig({
  optimizeDeps: {
    include: [
      "prop-types",
      "react-is",
      "hoist-non-react-statics",
      "react",
      "react-dom",
      '@emotion/react',
    ],
    exclude: ["@mui/material"],
  },
  plugins: [
    react(),
    pigment({
      theme,
      transformLibraries: [ "@mui/material"],
    }),
  ],
})

} catch (ex) {
if (lib !== MATERIAL_WRAPPER_LIB) {
console.warn(
`${process.env.PACKAGE_NAME}: You haveve specified "${lib}" in "transformLibraries" but it is not installed.`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
`${process.env.PACKAGE_NAME}: You haveve specified "${lib}" in "transformLibraries" but it is not installed.`,
`${process.env.PACKAGE_NAME}: You have specified "${lib}" in "transformLibraries" but it is not installed.`,

@brijeshb42
Copy link
Contributor Author

What's this PR solve?

It won't work just yet. It needs some metadata in the package's package.json file. Here's the relevant change in @mui/material.

@brijeshb42 brijeshb42 merged commit b7cda5f into mui:master Jul 10, 2024
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants