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] Avoid variable name collisions on tmpl, generateMarkup, etc. #5109

Open
nolanlawson opened this issue Jan 8, 2025 · 1 comment
Open

Comments

@nolanlawson
Copy link
Collaborator

If a component author does something like the following:

import { LightningElement } from 'lwc';

const tmpl = undefined;
const generateMarkup = undefined;

export default class extends LightningElement {
    connectedCallback() {
        // just use the variables to avoid them being tree-shaken
        Object.assign(
            {},
            {
                tmpl,
                generateMarkup
            }
        );
    }
}

Then currently, it will throw an error at compile time in the @lwc/ssr-compiler:

Identifier "tmpl" has already been declared
Identifier "generateMarkup" has already been declared

These are pretty generic names, so we should probably switch to something like __lwcTemplate and __lwcGenerateMarkup to avoid collisions.

Related:

Copy link

git2gus bot commented Jan 8, 2025

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

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

1 participant