-
Notifications
You must be signed in to change notification settings - Fork 296
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
Support rxjs operators w/ different import syntaxes #73
Comments
@davidenke can you reproduce this? I think I've updated a few of "our's" libraries today to latest versions of Angular and RxJS and they still build fine. Our CI's went through all fine and I think it went up to typescript 2.4 and rxjs 5.4.x - there was a build error with rxjs and typescript 2.4 which was resolved in the latest rxjs version?!? |
@dherges you're right, it turned out that I had issues with lodash. Btw. have you ever experienced issues with building relating lodash imports? |
Okay, I discovered this issue again and built a simple test case.
Content of {
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
"src": ".",
"workingDirectory": "./.packagr-cache",
"lib": {
"entryFile": "./public_api.ts",
"externals": {}
}
} Content of {
"name": "@test/test",
"version": "0.0.0",
"description": "",
"scripts": {
"build": "ng-packagr -p ./ng-package.json"
},
"peerDependencies": {
"@angular/animations": "^4.0.0",
"@angular/cdk": "2.0.0-beta.8",
"@angular/common": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/material": "2.0.0-beta.8",
"rxjs": "^5.4.2"
},
"devDependencies": {
"@angular/animations": "^4.0.0",
"@angular/cdk": "2.0.0-beta.8",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/forms": "^4.0.0",
"@angular/http": "^4.0.0",
"@angular/material": "2.0.0-beta.8",
"@angular/platform-browser": "^4.0.0",
"@compodoc/compodoc": "^1.0.0-beta.10",
"codelyzer": "^3.1.2",
"http-server": "^0.10.0",
"ng-packagr": "^1.0.0-pre.10",
"rxjs": "^5.4.2",
"sass-lint": "^1.10.2",
"tslint": "^5.5.0",
"tslint-microsoft-contrib": "^5.0.1",
"zone.js": "^0.8.14"
}
} Content of import { CommonModule } from '@angular/common';
import { NgModule } from '@angular/core';
import { LIVE_ANNOUNCER_PROVIDER, MdButtonModule, MdCommonModule, MdIconModule, OverlayModule, PortalModule } from '@angular/material';
@NgModule({
imports: [
OverlayModule,
PortalModule,
CommonModule,
MdButtonModule,
MdCommonModule,
MdIconModule
],
exports: [
OverlayModule,
PortalModule,
CommonModule,
MdButtonModule,
MdCommonModule,
MdIconModule
],
declarations: [],
providers: []
})
export class TestModule {
} Content of {
"compileOnSave": false,
"compilerOptions": {
"outDir": "./dist/out-tsc",
"baseUrl": "./src",
"sourceMap": true,
"declaration": false,
"module": "es2015",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es2015",
"typeRoots": [
"node_modules/@types"
],
"types": [],
"lib": [
"es2015",
"dom"
],
"paths": {
"@test/test": [
"./public_api.ts"
]
},
"include": [
"**/*.ts"
],
"exclude": [
"**/*.d.ts",
"./.packagr-cache",
"./src/test.ts",
"./src/**/*.spec.ts"
]
}
} Install dependencies with |
After digging into it further, I think it is related to #62. |
I'm getting a similar issue:
Tried to add |
@DDeis in my case the declaration of externals used by material helped: {
"$schema": "./node_modules/ng-packagr/ng-package.schema.json",
"lib": {
"entryFile": "./public_api.ts",
"externals": {
"rxjs/observable/forkJoin": "Rx.Observable",
"rxjs/observable/fromEvent": "Rx.Observable",
"rxjs/observable/merge": "Rx.Observable",
"rxjs/observable/of": "Rx.Observable",
"rxjs/observable/throw": "Rx.Observable",
"rxjs/operator/auditTime": "Rx.Observable.prototype",
"rxjs/operator/catch": "Rx.Observable.prototype",
"rxjs/operator/debounceTime": "Rx.Observable.prototype",
"rxjs/operator/do": "Rx.Observable.prototype",
"rxjs/operator/filter": "Rx.Observable.prototype",
"rxjs/operator/finally": "Rx.Observable.prototype",
"rxjs/operator/first": "Rx.Observable.prototype",
"rxjs/operator/map": "Rx.Observable.prototype",
"rxjs/operator/share": "Rx.Observable.prototype",
"rxjs/operator/startWith": "Rx.Observable.prototype",
"rxjs/operator/switchMap": "Rx.Observable.prototype",
"rxjs/operator/takeUntil": "Rx.Observable.prototype"
}
}
} @dherges Would it make sense to add those import usages to the external defaults as well? |
Yes sure! Personally, I prefer the If included, it would be nice to mirror the whole list |
@dherges me too. Shall I pr that, though? |
My bad, for me adding I ended up with:
Though I also made it works by adding {
include: 'node_modules/rxjs/**' // also works with 'node_modules/**'
} This way, we don't need RxJS dependencies in |
I agree, that looks cleaner. But I have no idea if including all |
You may be right, I edited the PR to only include |
tbh, I cannot fully undertand how this issue arrives and why the change is needed. In dherges/ng-packaged, usage of rxjs 5.4.2 is demonstrated. There's a service using Observables and operators w/ the maybe "old-fashioned" (?) If this about the "newer" I am open to PRs that improve ng-packagr. Right now, I consider this issue a "support request" or "help wanted". To met, it does not look like a bug or defect in here... |
Because Angular Material uses the "ugly" import style. We can leave a hint in the readme what to import, or just add the rxjs dependencies in the defaults. |
This issue has been automatically locked due to inactivity. |
Building with rxjs version 5.4.2 throws an error.
Started build with
ng-packagr -p ./ng-package.json
.Console output (shortened, removed usual npm error message:
In the moment I have no idea why this happens, since Observable.merge hasn't been removed and is still exported properly at first sight...
The text was updated successfully, but these errors were encountered: