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

[FEAT]: Add support for Angular Material custom package.json exports #112

Closed
2 tasks
brandonroberts opened this issue Oct 17, 2022 · 1 comment · Fixed by #141
Closed
2 tasks

[FEAT]: Add support for Angular Material custom package.json exports #112

brandonroberts opened this issue Oct 17, 2022 · 1 comment · Fixed by #141
Labels
accepting PRs enhancement New feature or request good first issue Good for newcomers

Comments

@brandonroberts
Copy link
Member

brandonroberts commented Oct 17, 2022

Which scope/s are relevant/related to the feature request?

vite-plugin-angular

Information

Angular Material uses custom sass and style properties in the package.json exports. When using the imports from Angular Material themes with Vite, it throws an error as it cannot resolve them. This can be fixed by adding sass and style to the resolve.conditions in the Vite config.

We can support this out of the box by adding it to the plugin, where the config will get merged into the provided config.

import { defineConfig } from 'vite';
import angular from '@analogjs/vite-plugin-angular';

// https://vitejs.dev/config/
export default defineConfig(({ mode }) => {
  return {
    plugins: [
      angular({
        inlineStylesExtension: 'scss',
      }),
    ],
    resolve: {
      conditions: ['sass', 'style'], // <-- add to vite plugin
      mainFields: ['module'],
    },
  };
});

Reference yharaskrik/analog-nx-15@c76f4d7#diff-28948f0a986cd471c15c0d8c8d3a3ae39a1b7f8b054af7deb4032b01823dd42e

Describe any alternatives/workarounds you're currently using

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@brandonroberts brandonroberts added the enhancement New feature or request label Oct 17, 2022
@brandonroberts brandonroberts changed the title Add support for Angular Material custom exports Add support for Angular Material custom package.json exports Oct 17, 2022
@brandonroberts brandonroberts changed the title Add support for Angular Material custom package.json exports [FEAT]: Add support for Angular Material custom package.json exports Oct 17, 2022
miluoshi added a commit to miluoshi/analog that referenced this issue Nov 14, 2022
@miluoshi
Copy link
Contributor

Maybe this fix is related? angular/angular-cli@0662a2e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepting PRs enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants