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

[SSR v2] Fix unused imports from '@lwc/ssr-runtime' #4793

Open
nolanlawson opened this issue Nov 7, 2024 · 5 comments
Open

[SSR v2] Fix unused imports from '@lwc/ssr-runtime' #4793

nolanlawson opened this issue Nov 7, 2024 · 5 comments

Comments

@nolanlawson
Copy link
Collaborator

In core, this Rollup warning is treated as an error:

LWC1002: Error in module resolution: "api", "track" and "wire" are imported from external
module "@lwc/ssr-runtime" but never used in `foo.js`

This happens because sometimes we are sloppy about doing e.g.:

import { api } from '@lwc/ssr-runtime'

... in the output .js files from the @lwc/ssr-compiler, even though api may be unused.

We should clean this up and ensure that all of our imports are actually used.

Copy link

git2gus bot commented Nov 7, 2024

This issue has been linked to a new work item: W-17152250

@nolanlawson nolanlawson changed the title [SSR v2] Fix unused imports from '@lwc/ssr-runtime'` [SSR v2] Fix unused imports from '@lwc/ssr-runtime' Nov 7, 2024
@cardoso
Copy link
Contributor

cardoso commented Nov 11, 2024

@nolanlawson aren't the decorators always compiled away?

@nolanlawson
Copy link
Collaborator Author

@cardoso Rollup removes the unused imports in our unit tests, yeah. But on-core, these warnings turn into errors because we're much stricter.

@cardoso
Copy link
Contributor

cardoso commented Nov 11, 2024

@nolanlawson I think that part I understand. I'm actually wondering if the fix here is simply removing the decorator imports during ssr. Or is there a case they're referenced at runtime?

@nolanlawson
Copy link
Collaborator Author

Well some of them haven't been implemented yet. 🙂 See #4807 for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants