[x] BUG (?)
Material2 should work with webpack1 like angular2 rc6 does.
Error "Uncaught SyntaxError: Unexpected token import"
Any solution with angular2 rc6 / material alpha 8-1; bundles with webpack.
I'm just an amateur, but as far as I see angular2 exports umd modules by default and material should (does?!) aswell. The error comes from every material-component indicating that modules picked up by webpack are in es2015 format ... or am I missing something?
angular2 rc6 / material 2 alpha 8-1 / win10 / typescript 2.0 beta
I had the same problem and my solution was this.
Instead of :
import {MdCoreModule} from "@angular2-material/core"
import {RtlModule} from "@angular2-material/core/rtl/dir";
import {OverlayModule} from "@angular2-material/core/overlay/overlay-directives";
...
and other stuff from @angular2-material/core/..
Do this:
import {MdCoreModule,RtlModule, OverlayModule, ...} from '@angular2-material/core';
My tsconfig.json looks like this:
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"sourceMap": true,
"moduleResolution": "node",
"noEmitHelpers": true
},
"compileOnSave": false,
"buildOnSave": false
}
Actually your solution fixed it :)
And fixing some of my wrong imports
import {MdButtonToggleModule} from '@angular2-material/button-toggle/button-toggle';
to
import {MdButtonToggleModule} from '@angular2-material/button-toggle';
.. obvious but I totally missed that .. . .. Sorry. It's working now :+1:
Thanks @mvukic ! Your solution fixed my issue also. I was using the example file from https://github.com/jelbourn/material2-app/blob/master/src/app/app.module.ts. The readme example worked ok, but the actual code in the repo did not.
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._
Most helpful comment
I had the same problem and my solution was this.
Instead of :
and other stuff from @angular2-material/core/..
Do this:
My tsconfig.json looks like this: