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

feat: add vite plugin #1651

Merged
merged 8 commits into from
Jan 30, 2023
Merged

feat: add vite plugin #1651

merged 8 commits into from
Jan 30, 2023

Conversation

bigopon
Copy link
Member

@bigopon bigopon commented Jan 22, 2023

Pull Request

📖 Description

  • Add a plugin to support Vite
  • Refactor hmr generation code, so that different plugin can generate hmr code differently, also independently with existing compiled component code. Example:
import { CustomElement as $$CE } from '@aurelia/runtime-html';

transformHtmlImportSpecifier: (s) => {
return this.meta.watchMode
? s
: s.replace(/\.html$/, '.$au.ts')
Copy link
Member Author

Choose a reason for hiding this comment

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

@3cp @brandonseydel This the way the plugin works, to work around issues of vite plugin order difference between dev and production build + watch/non watch modes.
It changes the .html import to .$au.ts and the intercepting loader from this plugin will take over.

Comment on lines +103 to +111
`import { Metadata as $$M } from '@aurelia/metadata';
import { ExpressionKind as $$EK } from '@aurelia/runtime';
import {
Controller as $$C,
CustomElement as $$CE,
IHydrationContext as $$IHC,
PropertyBinding as $$PB,
ContentBinding as $$CB,
} from '@aurelia/runtime-html';
Copy link
Member Author

Choose a reason for hiding this comment

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

with these aliases, the imports for hmr can stay independent of the component import without having to worry about conflicts.

@3cp
Copy link
Member

3cp commented Jan 22, 2023

Cheers!
Did you commit the vite package files? Cannot find any.

@bigopon
Copy link
Member Author

bigopon commented Jan 23, 2023

Did you commit the vite package files? Cannot find any.

What files do you expect? I'm a bit confused, can you help point out clearer?

@3cp
Copy link
Member

3cp commented Jan 23, 2023

I didn't see any new package under packages-tooling.

@3cp
Copy link
Member

3cp commented Jan 23, 2023

NVW, I found yours in vite.config.js.

I was expecting you put that logic in a package.

@codecov
Copy link

codecov bot commented Jan 30, 2023

Codecov Report

Merging #1651 (a8a8a44) into master (34c1338) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1651   +/-   ##
=======================================
  Coverage   87.85%   87.85%           
=======================================
  Files         240      240           
  Lines       22174    22174           
  Branches     5009     5009           
=======================================
  Hits        19481    19481           
  Misses       2693     2693           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@bigopon bigopon merged commit 5f3a88d into master Jan 30, 2023
@bigopon bigopon deleted the feat/vite-plugin2 branch January 30, 2023 06:56
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.

None yet

2 participants