Skip to content

Warnings regarding ignored imports due to "sideEffects" being set to false in package.json #491

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

Open
br0wsa opened this issue Mar 19, 2025 · 0 comments
Assignees
Labels
bug Something isn't working low-prio

Comments

@br0wsa
Copy link

br0wsa commented Mar 19, 2025

Describe the bug

I am encountering several warnings related to imports being ignored because they are marked as having no side effects (sideEffects: false) in their respective package.json files. This issue is happening in the following dependencies:

  • @universal-middleware/hono
  • @mantine/core
  • @mantine/hooks
  • @radix-ui/react-icons

`[WARNING] Ignoring this import because "../../node_modules/.pnpm/@universal-middleware+hono@0.4.6_@cloudflare+workers-types@4.20250317.0_@hattip[email protected][email protected]/node_modules/@universal-middleware/hono/dist/index.js" was marked as having no side effects [ignored-bare-import]

../server/cloudflare-worker.mjs:15:7:
  15 │ import "@universal-middleware/hono";
     ╵        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

"sideEffects" is false in the enclosing "package.json" file:

../../node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@universal-middleware/hono/package.json:32:2:
  32 │   "sideEffects": false,
     ╵   ~~~~~~~~~~~~~

`

` [WARNING] Ignoring this import because "../../node_modules/.pnpm/@Mantine+core@7.17.2_@mantine[email protected]_react@19.0.0__@types[email protected]_react-dom_092886b1b535cdd8d6dd28ee8a58dc01/node_modules/@mantine/core/esm/index.mjs" was marked as having no side effects [ignored-bare-import]

../server/entries/pages_-admin-panel-_pages_admin-panel.mjs:16:7:
  16 │ import "@mantine/core";
     ╵        ~~~~~~~~~~~~~~~

It was excluded from the "sideEffects" array in the enclosing "package.json" file:

../../node_modules/.pnpm/@[email protected]_@[email protected][email protected]__@[email protected]_react-dom_092886b1b535cdd8d6dd28ee8a58dc01/node_modules/@mantine/core/package.json:19:2:
  19 │   "sideEffects": [
     ╵   ~~~~~~~~~~~~~`

etc...

Expected behavior

Impact
These warnings do not seem to break the application, but they could affect tree shaking and optimizations. It would be great if these modules could be marked as having side effects or be excluded from the sideEffects array where appropriate.

Possible Solution
Consider updating the sideEffects field in the package.json of these modules to true or explicitly marking them as having side effects to prevent the bundler from ignoring them.

Screenshots
Image

Additional context

  • OS: Ubuntu (latest version)
  • PC: Aspire A315-23
  • Package Manager: pnpm
  • Stack:
    • Cloudflare Workers (via Wrangler)
    • Mantine
    • Prettier, ESLint
    • Sentry
    • React
@br0wsa br0wsa added the bug Something isn't working label Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low-prio
Projects
None yet
Development

No branches or pull requests

2 participants