-
Notifications
You must be signed in to change notification settings - Fork 153
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
@fortawesome/Angular-FontAwesome doesn't work within an Angular 6 Library #65
Comments
Hello @RushuiGuan , i have the same problem, but i haven't any error shown. how do you show the error, my main tsconfig file is : {
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"rootDir": ".",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"strictPropertyInitialization": false,
"noStrictGenericChecks": false,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
],
"strict": true,
"paths": {
"lib": [
"dist/lib"
],
"lib/*": [
"dist/lib/*"
],
}
},
"exclude": [
"bazel-out",
"dist/example-app",
"dist/gallery",
"node_modules",
"**/*/node_modules",
"modules/schematics/src/*/files/**/*"
],
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
},
"bazelOptions": {
"suppressTsconfigOverrideWarnings": false
}
}
but after many tests, it appears that my build is extremely slow (5min) when i add icon to the library.. |
The 92% thing is almost certainly caused by this known issue in the minifier used for production builds in Webpack 4. The root cause has been fixed, but not yet integrated and released in Webpack 4. We have some workarounds for you to try in the meantime. |
@kirakishin I think my previous comment mostly addresses your scenario, based on your observation of the 92% thing. But @RushuiGuan, your issue seems different. I don't recall whether we have any integration tests for adding this library to another Angular library. Normally our library is added to an app. @scttcper or @devoto13: do you know what might be different or problematic in the build config with adding our Angular library to another Angular library? |
Looks like its coming from |
The workaround is to add @scttcper the code below in a library will cause the compile error when the TestComponent is declared in a module.
|
IIRC it is a TypeScript limitation, when emitting d.ts files (i.e. The workaround is to add explicit type annotation to the property (which in turn ensures that there is an import statement for the required type). E.g. PS Looks like the issue was fixed in TypeScript 2.9.1, so just need to wait until Angular adds support for this version. |
@mlwilkerson thanks a lot! now it takes 35 sec :) |
Thanks devoto. I will mark this as resolved. |
import { faEdit} from '@fortawesome/pro-light-svg-icons/faEdit'; library.add(faEdit, faAddressCard); works for me thank you @mlwilkerson |
Has the issue with 92% thing been fixed or do we still have to use the workaround ? |
@learnuser521 It is supposed to be fixed using Angular CLI 7+ and I do not experience this issue in my applications. However another user has reported that he still experiences this problem. If you can provide a reproduction for the problem using Angular CLI 7+ we can take a look, but without reproduction it is rather hard to do something. See #34 for more details. |
@devoto13 I have not yet updated to Angular 7, will get back if there are issues after the update. Thank you |
I am trying to run the Explicit reference code example within an Angular 6 library. It doesn't compile and here are the build errors.
Please note that it works for an application but not a library. The library is generated using the following command:
Thanks
-Rushui
The text was updated successfully, but these errors were encountered: