Skip to content

Commit

Permalink
fix(vite-plugin-angular): disable transform of component styles on build
Browse files Browse the repository at this point in the history
  • Loading branch information
mattlewis92 committed Jan 6, 2025
1 parent 5b3dbfe commit 639e93d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/vite-plugin-angular/src/lib/angular-vite-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,11 @@ export function angular(options?: PluginOptions): Plugin[] {
/**
* Encapsulate component stylesheets that use emulated encapsulation
*/
if (pluginOptions.liveReload && isComponentStyleSheet(id)) {
if (
watchMode &&
pluginOptions.liveReload &&
isComponentStyleSheet(id)
) {
const { encapsulation, componentId } = getComponentStyleSheetMeta(id);
if (encapsulation === 'emulated' && componentId) {
const encapsulated = ngCompiler.encapsulateStyle(code, componentId);
Expand Down Expand Up @@ -746,7 +750,7 @@ export function angular(options?: PluginOptions): Plugin[] {
tsCompilerOptions.compilationMode = 'experimental-local';
}

if (pluginOptions.liveReload) {
if (pluginOptions.liveReload && !watchMode) {
tsCompilerOptions['_enableHmr'] = true;
tsCompilerOptions['externalRuntimeStyles'] = true;
// Workaround for https://github.com/angular/angular/issues/59310
Expand Down

0 comments on commit 639e93d

Please sign in to comment.