-
-
Notifications
You must be signed in to change notification settings - Fork 221
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(vite-plugin-angular): add support for JIT mode #374
Conversation
✅ Deploy Preview for analog-blog ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for analog-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
✅ Deploy Preview for analog-app ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
@sand4rt this should help with Playwright compilation speed also. |
@brandonroberts Awesome! Gonna try this asap! |
@@ -31,6 +31,6 @@ export function platformPlugin(opts: Options = {}): Plugin[] { | |||
(platformOptions.ssr | |||
? devServerPlugin({ entryServer: opts.entryServer }) | |||
: false) as Plugin, | |||
...angular(opts?.vite), | |||
...angular({ jit: platformOptions.jit, ...opts?.vite }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If opts?.vite
ends up being undefined this spread will error. I think you want ...(opts?.vite ?? {})
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, thanks
9b90608
to
7f9e0d6
Compare
}); | ||
|
||
return { | ||
code: result?.code || '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor (non-blocking): Wouldn't make sense to use the ??
instead of ||
here?
}: { | ||
inlineStylesExtension: string; | ||
}): Plugin { | ||
let styleTransform: PluginContainer['transform'] | undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: if we have a utils library/functions somewhere we could add a Utility type like this:
type ExtractMethodSignature<T extends Record<any, any>, K> = T[K];
and this way you can change this to:
let styleTransform: ExtractMethodSignature<PluginContainer, 'transform'> | undefined;
This would make only sense if we do this many times in our code. Maybe there is a better TS solution for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gergobergo the correct TS solution is already being used. There's no point in abstracting something that doesn't need to be abstracted.
7f9e0d6
to
5e758c9
Compare
@brandonroberts thought the |
@sand4rt it supports |
@KlausEverWalkingDev this is the same as disabling |
Oh, thanks. I added it while reading the analog source files, but I admit I didn't understand the real meaning of it. By the way, what's the difference between analog and angular plugin? I didn't get when to use only one of them or both. |
The analog plugin is the "glue" between the analog packages. The angular plugin is what handles connecting Angular compilation to Vite. It can be used on its own and is used for Astro, Qwik, and other Vite integration |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Which package are you modifying?
What is the current behavior?
Closes #368
What is the new behavior?
Enabling JIT mode through the Analog Platform and Vite Angular Plugin is an option.
When running tests, JIT mode is used instead of AOT which provides faster compilation of files, while still supporting internal and external styles and templates. This will speed up compilation time with libraries such as Vitest, Playwright, Storybook, etc.
Does this PR introduce a breaking change?
Other information