You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've completed the setup and tried running the SSR locally, unfortunately whenever i try to hit localhost:5000 i get an error on the Firebase function:
SyntaxError: Unexpected token import
Which from I can gather from my research is related to Node.js not supporting modern versions of ES and can be solved by includingvar express = require("express");
Unfortunately that doesn't seem to fix the issue.
The log is as follows:
=== Serving from ''...
i functions: Preparing to emulate functions.
Warning: You're using Node.js v8.9.0 but Google Cloud Functions only supports v6.11.1.
i hosting: Serving hosting files from: dist
✔ hosting: Local server: http://localhost:5000
✔ functions: trigger: http://localhost:5001/curselo-web/us-central1/trigger
[hosting] Rewriting / to local function trigger
info: User function triggered, starting execution
error: /functions/node_modules/@angular-mdl/core/components/button/mdl-button.component.js:11
import { Component, Input, ElementRef, Renderer2, NgModule, ViewEncapsulation } from '@angular/core';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.jriz (/functions/dist-server/main.bundle.js:1:707107)
info: Execution took 82 ms, finished with status: 'crash'
127.0.0.1 - - [01/Nov/2017:15:31:55 +0000] "GET / HTTP/1.1" 500 99 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36"
error: Function worker crashed with exit code: 1
The text was updated successfully, but these errors were encountered:
jirungaray
changed the title
File not found when serving locally
SyntaxError: Unexpected token import when serving locally
Nov 1, 2017
Getting the same problem with ngx-translate/core, according to this issue a fix would be to convert the package to es2015 using Babel: ngx-translate/core#581
After using babel to convert the module to es2015 I tried to serve the application via "firebase serve --only functions,hosting". Although the error went gone a new error pops up without any useful info: Failed to emulate ssrapp
It is worth mentioning the same application does run via SSR via the built in Angular Universal Starter command: "npm run serve:ssr". So something strange seems to be going on.
I did some research and indeed the issue is because of node not supporting ES6, I re transpiled some libs and got it to go away. Unfortunately some other libs started failing because they are not SSR compatible.
At this point i'm trying some final hacks before dropping angular, to be honest it doesn't seem to be production ready.
I've completed the setup and tried running the SSR locally, unfortunately whenever i try to hit localhost:5000 i get an error on the Firebase function:
Which from I can gather from my research is related to Node.js not supporting modern versions of ES and can be solved by including
var express = require("express");
Unfortunately that doesn't seem to fix the issue.
The log is as follows:
The text was updated successfully, but these errors were encountered: