Skip to content

Make Angular Material work in offline compiler #774

Closed

Description

@jelbourn
No description provided.

Activity

  1. added
    P1Impacts a large percentage of users; if a workaround exists it is partial or overly painful
    on Jun 27, 2016
  2. added this to the alpha.7 milestone on Jun 27, 2016
  3. luisfurnas commented on Aug 30, 2016

    @luisfurnas

    When trying to offline compile my Angular app, I get this error:

    Error encountered resolving symbol values statically. Reference to a local (non-exported) symbol 'coreModules'.

    I'm trying to use the MdTooltipModule in my bootstrap module, but it doesn't compile 👎

  4. cyrilletuzi commented on Sep 13, 2016

    @cyrilletuzi
    Contributor

    (edit : corrected the issue number)

    #883 has been closed as a duplicate of this issue, but I don't think they are the same.

    I'm running an app with AoT offline compiler and Material modules (icon, button, card, input, menu, toolbar), and it's working very well.

    But it is not working with Universal. I get the same "window is not defined" error, as mentioned in #883.

    After a quick look at the code, Material umd bundles are full of reference to "window". Is that normal ?

  5. orangesoup commented on Sep 14, 2016

    @orangesoup

    @cyrilletuzi I'm trying to work with Universal as well, no luck so far. You can bypass the window error by putting var window = undefined in those umd bundles, but after that I ran into an issue:

    /.../node_modules/@angular2-material/core/ripple/ripple.js:10
    import { NgModule, Directive, ElementRef, HostBinding, Input } from '@angular/core';
    ^^^^^^
    SyntaxError: Unexpected token import
    

    I'm really not a webpack/node guy, but it's probably just a configuration issue, although I really can't find out what I should do. Any idea?

  6. cyrilletuzi commented on Sep 14, 2016

    @cyrilletuzi
    Contributor

    @orangesoup Thanks for the var window = undefined; trick, it worked. Of course it is not a good solution, but I don't know how to fix that correctly, any idea @jelbourn @hansl ?

    @orangesoup Your import problem is just a config problem. Your tsconfig.json for ts-node must be set as :

    "target": "es2015",
    "module": "commonjs"
    

    (which is not the same config as for your webpack client build).

  7. jelbourn commented on Sep 14, 2016

    @jelbourn
    ContributorAuthor

    See #308

    We haven't had the opportunity yet to ensure that everything works with Universal, but it will be coming within the next few milestones. Happy to accept PRs to help improve this sooner, though.

    I'm actually going to close this issue now, since everything should be good for AoT AFAIK, and Angular Universal is tracked via #308.

  8. orangesoup commented on Sep 14, 2016

    @orangesoup

    @cyrilletuzi You mean I have to manually build material with that tsconfig?

  9. cyrilletuzi commented on Sep 14, 2016

    @cyrilletuzi
    Contributor

    @orangesoup no you don't need to build on server side, but as Angular 2 is in TypeScript, which is not understood by node natively, you need to use ts-node with that config.

  10. dotansimha commented on Sep 15, 2016

    @dotansimha

    Any solution so far?
    I am using Universal and unable to import the material modules.
    Always the same error - "window is no defined". using alpha8-1.
    Older versions worked just fine :(

  11. cyrilletuzi commented on Sep 17, 2016

    @cyrilletuzi
    Contributor

    @dotansimha @orangesoup See a temporary workaround here in #308

  12. angular-automatic-lock-bot commented on Sep 5, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  13. locked and limited conversation to collaborators on Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1Impacts a large percentage of users; if a workaround exists it is partial or overly painful

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions