GustavoCostaW / ngc-float-button

Google Material Design Float Button - Implementation for Angular v4+. Demo: http://bit.ly/2yIya2f
MIT License
58 stars 24 forks source link

ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function #2

Closed henry74 closed 6 years ago

henry74 commented 7 years ago

Getting this error when attempting to use this component with an ng bulid. The full error:

ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 194:50 in the original .ts file), resolving symbol NgModule in /home/henry/Documents/ss-master/ss-ui/node_modules/ngc-float-button/node_modules/@angular/core/core.d.ts, resolving symbol NgcFloatButtonModule in /home/henry/Documents/ss-master/ss-ui/node_modules/ngc-float-button/index.ts, resolving symbol NgcFloatButtonModule in /home/henry/Documents/ss-master/ss-ui/node_modules/ngc-float-button/index.ts

Here's a thread on @angular/cli which appears related.

Thoughts?

GustavoCostaW commented 7 years ago

Hey @henry74 thank you for the issue, I will investigate, but if you use ng build in the /sample/ folder the build is completed, are you using specific param? like --aot ... ?

henry74 commented 7 years ago

I'm not using any parameters. I'm running ng build on my angular application where the ngc-float-button is included in the package.json file.

ng --version
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.3.1
node: 8.4.0
os: linux x64
@angular/animations: 4.3.5
@angular/cdk: 2.0.0-beta.8
@angular/cli: 1.3.1
@angular/common: 4.3.5
@angular/compiler: 4.3.5
@angular/compiler-cli: 4.3.5
@angular/core: 4.3.5
@angular/flex-layout: 2.0.0-beta.8
@angular/forms: 4.3.5
@angular/http: 4.3.5
@angular/material: 2.0.0-beta.8
@angular/platform-browser: 4.3.5
@angular/platform-browser-dynamic: 4.3.5
@angular/router: 4.3.5
@angular/language-service: 4.3.5
GustavoCostaW commented 7 years ago

@henry74 I will check with the exactly angular cli version, thx

GustavoCostaW commented 7 years ago

@henry74 I created a simple application to only use the ngc-float-button and I no received any errors, you can see the terminal logs with:

ng build

and

ng build --aot

The unique problem was with --aot but with 1.1.0 is fixed.

My test version:

Gustavo-MacBook-Pro:my-app gustavocostaw$ ng version
    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.3.2
node: 6.9.2
os: darwin x64
@angular/animations: 4.3.6
@angular/common: 4.3.6
@angular/compiler: 4.3.6
@angular/core: 4.3.6
@angular/forms: 4.3.6
@angular/http: 4.3.6
@angular/platform-browser: 4.3.6
@angular/platform-browser-dynamic: 4.3.6
@angular/router: 4.3.6
@angular/cli: 1.3.2
@angular/compiler-cli: 4.3.6
@angular/language-service: 4.3.6

if you need I can share the project with you, but, first, try to update your angular cli.

henry74 commented 7 years ago

Going to do some testing on my end. Let me see if I can recreate. I'm on node 8 versus node 6, but don't think that makes a difference.

GustavoCostaW commented 7 years ago

@henry74 okay, let me know if you have any problem.

daremachine commented 7 years ago

Hi, I have same problem if I use mock http backend.

If I have this in app.module.ts

const APP_PROVIDERS = [
    AccountService,

    // providers used to create fake backend
    fakeBackendProvider,
    MockBackend,
    BaseRequestOptions
];

The compilation fail with this error BUT If I comment fakeBackendProvider, compilation is success and next If I uncomment fakeBackendProvider, the HMR compile again with success and everything work as expected.

This is really curious behaviour.

GustavoCostaW commented 7 years ago

@daremachine Yep, it's very strange behavior... can you provide the error message?

daremachine commented 7 years ago

@GustavoCostaW yes, here is it:

ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function (position 7:17 in the original .ts file), resolving symbol fakeBackendProvider in M:/wamp/www/a/src/app/_testing/fake-backend.ts, resolving symbol AppModule in M:/wamp/www/a/src/app/app.module.ts, resolving symbol AppModule in M:/wamp/www/a/src/app/app.module.ts webpack: Failed to compile.

And here is my fakeBackendProvider:

import { Http, BaseRequestOptions, Response, ResponseOptions, RequestMethod } from '@angular/http';
import { MockBackend, MockConnection } from '@angular/http/testing';

export let fakeBackendProvider = {
    // use fake backend in place of Http service for backend-less development
    provide: Http,
    useFactory: (backend: MockBackend, options: BaseRequestOptions) => {
        // configure fake backend
        backend.connections.subscribe((connection: MockConnection) => {
            // wrap in timeout to simulate server api call
            setTimeout(() => {

                // get company
                if (connection.request.url.match(/\/api\/v1\/companies+$/) && connection.request.method === RequestMethod.Get) {
                    // respond 200 OK
                    connection.mockRespond(new Response(new ResponseOptions({
                        status: 200,
                        body: {
                            "id": "810fdb64-5925-46e3-a74f-a89e2f329f81",
                            "name": "Company name",
                            "shortDescription": "short description text",
                            "description": "description long text",
                            "email": "asd@asd.asd",
                            "owner": {
                                "id": "810fdb64-5925-46e3-a74f-a89e2f329f81",
                                "email": "asd@asd.asd"
                            },
                            "createAt": "2017-11-05T20:00:00+02:00"
                        }
                    })));
                }
            }, 500);
        });

        return new Http(backend, options);
    },
    deps: [MockBackend, BaseRequestOptions]
};
daremachine commented 7 years ago

@GustavoCostaW Man, today I copied cleaned project to new folder without node_modules and exec npm install and then npm start and compiled success. Then stop and start again and get this error.

GustavoCostaW commented 7 years ago

@daremachine Okay, today I will check again this strange behavior, thank you.

GustavoCostaW commented 6 years ago

I finally find the problem, in this weekend I will launch the new version of this lib!

GustavoCostaW commented 6 years ago

Hey @henry74 @daremachine , unfortunately, I was pretty sick because of this I took so long to fix that, sorry and I just published the new version and it's compatible with angular >= 4.4.4 and >= angular material beta 12, enjoy.

just run npm install --save ngc-float-button

You can check the demo with the latest version. http://bit.ly/2yIya2f