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

fix(rollup-plugin): allow any implicit HTML import from any kind of script file @W-15941938 #4261

Merged
merged 3 commits into from
Jun 10, 2024

Conversation

wjhsf
Copy link
Contributor

@wjhsf wjhsf commented Jun 5, 2024

To detect whether a component is using an implicit HTML import, we check that it's a .js file. But that's not the only kind of script file that can be used! This PR adds support for all flavors of JS/TS/JSX that we might expect to encounter.

Fixes #4233.

Details

Does this pull request introduce a breaking change?

  • 😮‍💨 No, it does not introduce a breaking change.

Does this pull request introduce an observable change?

  • 🔬 Yes, it does include an observable change.

GUS work item

W-15941938

@wjhsf wjhsf requested a review from a team as a code owner June 5, 2024 15:55
});
const { code } = result.output[0];

expect(code).toContain('all your base');
Copy link
Contributor

Choose a reason for hiding this comment

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

Are they belong to us?

@@ -65,13 +65,14 @@ const IMPLICIT_DEFAULT_HTML_PATH = '@lwc/resources/empty_html.js';
const EMPTY_IMPLICIT_HTML_CONTENT = 'export default void 0';
const IMPLICIT_DEFAULT_CSS_PATH = '@lwc/resources/empty_css.css';
const EMPTY_IMPLICIT_CSS_CONTENT = '';
const SCRIPT_FILE_EXTENSIONS = ['.js', '.mjs', '.jsx', '.ts', '.mts', '.tsx'];
Copy link
Contributor

Choose a reason for hiding this comment

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

Set / has may be faster, but maybe not since this is a tiny list anyway.

@wjhsf wjhsf merged commit 7397f45 into master Jun 10, 2024
10 checks passed
@wjhsf wjhsf deleted the wjh/rollup-any-script-file branch June 10, 2024 14:04
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.

Inherited template not found when using TypeScript and Babel
3 participants