Skip to content

Commit

Permalink
fix(astro-angular,vite-plugin-angular): update zone.js deep imports f…
Browse files Browse the repository at this point in the history
…or compatibility (#651)
  • Loading branch information
rlmestre committed Sep 15, 2023
1 parent b909466 commit 704e2e9
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 36 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
"ufo": "^1.1.2",
"xhr2": "^0.2.1",
"zod": "^3.21.4",
"zone.js": "0.13.1"
"zone.js": "^0.13.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "16.2.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-angular/src/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'zone.js/dist/zone.js';
import 'zone.js';
import {
EnvironmentProviders,
Provider,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-angular/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'zone.js/bundles/zone-node.umd.js';
import 'zone.js/node';
import type {
ComponentMirror,
EnvironmentProviders,
Expand Down
9 changes: 0 additions & 9 deletions packages/platform/src/lib/ssr/ssr-build-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,6 @@ import { normalizePath, Plugin } from 'vite';
export function ssrBuildPlugin(): Plugin {
return {
name: 'analogjs-ssr-build-plugin',
config(_config) {
return {
resolve: {
alias: {
'zone.js/node': 'zone.js/bundles/zone-node.umd.js',
},
},
};
},
transform(code, id) {
if (id.includes('platform-server')) {
code = code.replace(/global\./g, 'globalThis.');
Expand Down
8 changes: 4 additions & 4 deletions packages/vite-plugin-angular/setup-vitest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'zone.js';
import 'zone.js/dist/sync-test';
import 'zone.js/dist/proxy';
import 'zone.js/plugins/sync-test';
import 'zone.js/plugins/proxy';
import 'zone.js/testing';

/**
Expand All @@ -23,10 +23,10 @@ const SyncTestZoneSpec = Zone['SyncTestZoneSpec'];
const ProxyZoneSpec = Zone['ProxyZoneSpec'];

if (SyncTestZoneSpec === undefined) {
throw new Error('Missing: SyncTestZoneSpec (zone.js/dist/sync-test)');
throw new Error('Missing: SyncTestZoneSpec (zone.js/plugins/sync-test)');
}
if (ProxyZoneSpec === undefined) {
throw new Error('Missing: ProxyZoneSpec (zone.js/dist/proxy.js)');
throw new Error('Missing: ProxyZoneSpec (zone.js/plugins/proxy.js)');
}

const env = globalThis as any;
Expand Down
2 changes: 1 addition & 1 deletion packages/vite-plugin-nitro/src/lib/vite-plugin-nitro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export function nitro(options?: Options, nitroOptions?: NitroConfig): Plugin[] {
inline: ['zone.js/node'],
external: ['rxjs', 'node-fetch-native/dist/polyfill', 'destr'],
},
moduleSideEffects: ['zone.js/bundles/zone-node.umd.js'],
moduleSideEffects: ['zone.js/node'],
renderer: normalizePath(`${__dirname}/runtime/renderer`),
handlers: [
{
Expand Down
35 changes: 16 additions & 19 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 704e2e9

Please sign in to comment.