Skip to content
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

Make Angular Material work in offline compiler #774

Closed
jelbourn opened this issue Jun 27, 2016 · 10 comments
Closed

Make Angular Material work in offline compiler #774

jelbourn opened this issue Jun 27, 2016 · 10 comments
Assignees
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful
Milestone

Comments

@jelbourn
Copy link
Member

No description provided.

@jelbourn jelbourn added the P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful label Jun 27, 2016
@jelbourn jelbourn added this to the alpha.7 milestone Jun 27, 2016
@luisfurnas
Copy link

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 👎

@cyrilletuzi
Copy link
Contributor

cyrilletuzi commented Sep 13, 2016

(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 ?

@orangesoup
Copy link

@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?

@cyrilletuzi
Copy link
Contributor

cyrilletuzi commented Sep 14, 2016

@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).

@jelbourn
Copy link
Member Author

jelbourn commented Sep 14, 2016

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.

@orangesoup
Copy link

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

@cyrilletuzi
Copy link
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.

@dotansimha
Copy link

dotansimha commented Sep 15, 2016

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 :(

@cyrilletuzi
Copy link
Contributor

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

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful
Projects
None yet
Development

No branches or pull requests

6 participants