angular-library

What is the proper way to use a dependent npm package in angular 6 library project?

余生颓废 提交于 2019-12-03 12:13:16
问题 I'm a little confused as to how im supposed to reference external npm packages in my library angular6 project. We have an internal scss library I'd like to use to style my reusable components in my library. How do i go about importing that? package.json for lib project: { "name": "ikr-lib", "version": "0.0.1", "peerDependencies": { "@angular/common": "^6.0.0-rc.0 || ^6.0.0", "@angular/core": "^6.0.0-rc.0 || ^6.0.0", "document-register-element": "1.8.1" }, "dependencies": { "element.ui": "^1.0

How to add global style to angular 6/7 library

左心房为你撑大大i 提交于 2019-12-03 02:31:01
I was trying to add global styles in the same way like in angular app, but it totally does not work. My libraries' name is example-lib , so I added styles.css to /projects/example-lib/ . I added styles in main angular.json file: ... "example-lib": { "root": "projects/example-lib", "sourceRoot": "projects/example-lib/src", "projectType": "library", "prefix": "ngx", "architect": { "build": { "builder": "@angular-devkit/build-ng-packagr:build", "options": { "tsConfig": "projects/example-lib/tsconfig.lib.json", "project": "projects/example-lib/ng-package.json", "styles": [ "projects/example-lib

Using React Component in Angular 2

做~自己de王妃 提交于 2019-12-03 00:23:50
I have a set of react components and i am trying to use them in an Angular 2 app. Here is the Main React Component that i am trying to use import React, {Component} from 'react'; import { createStore, applyMiddleware } from 'redux'; import { Provider } from 'react-redux'; import configureStore from './store/configureStore'; import MyCardContainer from './containers/MyCardContainer'; import './assets/style/main.css'; export default class MyCard extends Component { constructor(props){ super(props); } componentWillMount(){ } render(){ if(this.props.param1 && this.props.param2) { return (

angular-cli library create secondary entry point

最后都变了- 提交于 2019-11-30 14:47:29
I am trying to create what I believe is called a secondary entry point into my angular npm package. I want the following two entry points @scope/data-service @scope/data-service/models Using the angular-cli to generate the base package generates the following structure scope └───data-service │ karma.conf.js │ ng-package.json │ ng-package.prod.json │ package.json │ tsconfig.lib.json │ tsconfig.spec.json │ tslint.json │ └───src │ public_api.ts │ test.ts │ └───lib data-service.component.spec.ts data-service.component.ts data-service.module.ts data-service.service.spec.ts data-service.service.ts

'rootDir' is expected to contain all source files

妖精的绣舞 提交于 2019-11-29 13:21:32
I have an Angular CLI workspace containing two library projects, foo and bar . When I build the second of the two libraries, foo , the build fails with the following error: error TS6059: File '/code/projects/bar/src/lib/types.ts' is not under 'rootDir' '/code/projects/foo/src'. 'rootDir' is expected tocontain all source files. Error: error TS6059: File '/code/projects/bar/src/lib/types.ts' is not under 'rootDir' '/code/projects/foo/src'. 'rootDir' is expected to contain all source files. at Object.<anonymous> (/code/node_modules/ng-packagr/lib/ngc/compile-source-files.js:53:68) at Generator

'rootDir' is expected to contain all source files

随声附和 提交于 2019-11-28 07:10:39
问题 I have an Angular CLI workspace containing two library projects, foo and bar . When I build the second of the two libraries, foo , the build fails with the following error: error TS6059: File '/code/projects/bar/src/lib/types.ts' is not under 'rootDir' '/code/projects/foo/src'. 'rootDir' is expected tocontain all source files. Error: error TS6059: File '/code/projects/bar/src/lib/types.ts' is not under 'rootDir' '/code/projects/foo/src'. 'rootDir' is expected to contain all source files. at