Conditionally import Module depending on isserver or isbrowser #1047

Closed
opened 2025-08-09 17:18:40 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @bencameron00 on 2/7/2017

I am trying to use a third party module that works fine in a pure client side implementation.

In a JavaScriptServices implementation I get this error when I try to import AgmCoreModule...

ReferenceError: window is not defined

My import looks like this...

  imports: [
    UniversalModule,
    AgmCoreModule.forRoot({
      apiKey: 'XXX',
      libraries: ["places"]
    }),

I don't need this module in the server side version.
What is the best way to only import this for the browser version? Is this supported?

Thank you

*Originally created by @bencameron00 on 2/7/2017* I am trying to use a third party module that works fine in a pure client side implementation. In a JavaScriptServices implementation I get this error when I try to import AgmCoreModule... > ReferenceError: window is not defined My import looks like this... ``` imports: [ UniversalModule, AgmCoreModule.forRoot({ apiKey: 'XXX', libraries: ["places"] }), ``` I don't need this module in the server side version. What is the best way to only import this for the browser version? Is this supported? Thank you
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#1047
No description provided.