-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Angular Universal: SyntaxError: Unexpected token import #2369
Comments
I am also facing this problem. |
Same issue here too |
@saoron What version are you using? |
This is happening both on 1.8.1 and on the latest beta 2.0.0-beta.3. |
One option is to eject the webpack and whitelist ngx-bootstrap. But then that would defeat the purpose of using ang-cli. ngx-translate example |
I am using Angular 4 + universal. I followed the steps listed here to build universal code from my angular 4 codebase. On my end, this occurs after I use ang-cli to build my server code and then run |
If you are using Angular-CLI angular/angular-cli#7200 |
unfortunately, it is ng-cli issue, so we will have to wait for fix |
@neilhem thanks for link! |
So, according to @Toxicable it would appear that this, indeed, will fall on the libraries, not the cli. See here, and the few subsequent comments: angular/angular-cli#7200 (comment) |
I have the same problem. As I saw angular universal have problem with modal components. I tried ngx bootstrap modal and angular material modal. both had problem with universal. even with asp .net core universal problem exist. remove all modals component to fix the error |
We will publish fix next week, when qa out of vacation. |
I still met this issue in version: 1.9.0 Which version did you fix? |
@longhoang2984 angular unniversal support was added in 2.0.0-beta.8 |
I just upgraded ngx-bootstrap to 2.0.0-beta.8 (confirmed it by checking node modules) But I still get a carousel error
Can someone help me fix this ? |
I was explaining in similar issue, nodejs doest support es6 import style, so files should be compiled with webpack or typescript before using in node. |
This is why such questions should be on stack overwflow, so ppl can google it |
@abhijithmannath take a look on this thread |
@dafabulousteach Could you please let me know how did you solve this issue ? Thanks ! |
@b6791 Unfortunately, I never did solve this. But seeing that there has been a new release to ang-cli, there might be a fix. On the other hand, the problem is with ngx-bootstrap itself. Sorry I couldn't help. |
@dafabulousteach Anyway no problem thanks for the reply. |
Guys I have the same problem any suggestion : Error:
package.json:
|
Installing babel with the 1-7 instruction did not work for me... Do you recommend any troubleshooting steps? |
It is giving 404 |
This page is giving 404 |
I have been facing this problem for a very long. I use to do a workaround to bypass this. But finally, I have fixed this. So, here is the solution. Where did I find this problem:ngx-bootstrap Problem:This npm package is written in ES6 and is not being transpiled to support older environments like ES5. So, it does not understand the keyword like SolutionTo make the package compatible with our environment, we have to transpile it by ourselves. I did it using webpack and babel-loader to transpile ngx-bootstrap package. Steps:
module: {
rules: [
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules\/(?!ngx-bootstrap)/
}
]
} To understand transpilation and what's going wrong in this issue, I would recommend you to read this nice article How to transpile node modules. |
Update by @valorkin : blocked by Angular-CLI angular/angular-cli#7200
Hi Guys, Thank you for your great work!
I'm trying to make ngx-bootstrap work with Universal but getting this error when trying to run:
Any suggestions?
The text was updated successfully, but these errors were encountered: