Closed moritz-h closed 6 years ago
Found some more infos: The problem could be that you are providing .ts files in the npm package. See the second half of this comment:
So we don't really support using incorrectly packaged libraries with TS sources. It's something you do at your risk. https://github.com/angular/angular-cli/issues/8284#issuecomment-341417325
I can now confirm the *.ts files in the library as error source. As quick check I tried the following:
clone your repo
npm install
npm install --save-dev @types/es6-shim (needed for build)
npm run build
copy the dist/ folder to my-app/node_modules/ng-trim-value-accessor/
My app then builds without problems.
Thanks for the report and rundown. Do you mind submitting a PR for that?
I don't know if I can help with this. I have no experience in creating modules or in publishing anything on npm yet. I only know, that providing .ts files in a module is wrong from the above linked comment. So it must be something like "compile before uploading it to npm", but how exactly to do this is the question :-)
Ok seems not to hard. I can try making a PR. Infos from: http://ljn.io/posts/publishing-typescript-projects-with-npm/ https://www.twilio.com/blog/2017/06/writing-a-node-module-in-typescript.html https://stackoverflow.com/questions/30928253/writing-npm-modules-in-typescript
@moritz-h Can you please verify whether the latest version works for you?
@khashayar Looks good. ng serve
runs now also without --aot. In node_module/ng-trim-value-accessor/
are now only the .js and .d.ts files. No other .ts sources. :+1:
Great! Thanks for the PR!
Tested with a new empty project (Angular CLI 1.5.0 and Angular 5)
ng new test-project
npm install ng-trim-value-accessor --save
(include like in README)ng serve
Found a similar issue with workaround here: https://github.com/angular/angular/issues/20091