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

Preserve 'use-client' directives during rollup #70

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

rjwills28
Copy link
Collaborator

Previously we were getting a lot of warnings thrown during rollup that the use client directive from the 'mui' package were ignored:

(!) node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles.js (1:0): Module level directives cause errors when bundled, "use client" in "node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles.js" was ignored.
/cs-web-lib/node_modules/@mui/styled-engine/GlobalStyles/GlobalStyles.js:1:0
1: 'use client';
   ^
2: 
3: import * as React from 'react';

This use client directive is used by the mui package to mark the module as client code and therefore should probably be preserved during the rollup. There is a package rollup-preserve-directives that can do this so I have added this and configured it in the rollup.config file.

Fixes warnings thrown during rollup that 'use-client' directives
from the 'mui' package were ignored by instead preserving them.
Copy link
Collaborator

@abigailalexander abigailalexander left a comment

Choose a reason for hiding this comment

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

Tested that the rollup warnings are gone and the package installs as usual, all works. LGTM!

@rjwills28 rjwills28 merged commit 20064d0 into master Dec 10, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants