Closed jaibatrik closed 7 years ago
I think you have some problem in the way you build your library. I checked your .ngsummary.json
files and you have absolute paths like this: "filePath":"/Users/duttj2/WebProjects/angular4-social-login-old/a4sl-flat.d.ts"
. That's probably the cause of your build issues.
@filipesilva I surely have no clue on how the absolute path got generated. I am running the following command to build -
ngc && rollup -c
Below is the contents of my tsconfig.json
-
{
"compilerOptions": {
"target": "es5",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"declaration": true,
"stripInternal": true,
"inlineSources": true,
"skipLibCheck": true,
"lib": [
"es2015",
"dom"
],
"outDir": "dist",
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"./node_modules/@types/"
],
"baseUrl": ".",
"paths": {
"@angular/*": [
"./node_modules/@angular/*"
]
}
},
"files": [
"index.ts"
],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"strictMetadataEmit": true,
"skipTemplateCodegen": false,
"flatModuleOutFile": "a4sl-flat.js",
"flatModuleId": "a4sl-flat",
"genDir": "dist"
}
}
And below is my rollup.config.js
-
import nodeResolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import sourcemaps from 'rollup-plugin-sourcemaps';
// import uglify from 'rollup-plugin-uglify';
import * as _angular_core from '@angular/core';
export default {
entry: 'dist/a4sl-flat.js',
dest: 'dist/angular4-social-login.js', // output a single application bundle
sourceMap: true,
format: 'umd',
moduleName: 'Angular4SocialLogin',
external: [
'@angular/core'
],
globals: {
'@angular/core': 'ng.core'
},
onwarn: function (warning) {
// Skip certain warnings
// should intercept ... but doesn't in some rollup versions
if (warning.code === 'THIS_IS_UNDEFINED') { return; }
// console.warn everything else
console.warn(warning.message);
},
plugins: [
commonjs({
include: ['node_modules/rxjs/**']
}),
sourcemaps(),
nodeResolve({ jsnext: true, module: true })
// uglify()
]
};
Do you have any idea what might be causing absolute paths to appear in the JSONs?
And, of course, ng serve
works. Once I touch
any file. I really don't understand what's the deal with this compiler :(
Also, do I need to bundle the .ngsummary.json
files in the distributed package?
I removed them, so now the distributed package does not contain .ngsummary.json
files and there's no reference to absolute paths now. Yet, the same issue persists.
Could you please help?
I'm sorry but it's both out of scope for the CLI itself, and rather time intensive to debug your particular library setup and try to figure out what's going wrong with it. The best I can do is to direct you to the ongoing discussion about library support in the CLI: https://github.com/angular/angular-cli/issues/6510
It discusses a few of the challenges in creating libraries and lists several alternatives that work today. You should have success using the existing starters and they often offer setup instructions. This is better than rolling your own setup because it isn't very straightforward (as you're experiencing).
Thanks @filipesilva. I'll rather take that path and see how it goes.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
Bug Report or Feature Request (mark with an
x
)Versions.
@angular/cli: 1.2.6 node: 7.10.0 os: darwin x64 @angular/animations: 4.3.2 @angular/common: 4.3.2 @angular/compiler: 4.3.2 @angular/core: 4.3.2 @angular/forms: 4.3.2 @angular/http: 4.3.2 @angular/platform-browser: 4.3.2 @angular/platform-browser-dynamic: 4.3.2 @angular/router: 4.3.2 @angular/cli: 1.2.6 @angular/compiler-cli: 4.3.2 @angular/language-service: 4.3.2
Repro steps.
The log given by the failure.
Desired functionality.
The
SocialLoginModule
(coming from angular4-social-login node module) publishes the.ngsummary.json
as required. One can check that by navigating to./node_modules/angular4-social-login/dist/lib
directory.I understand and have seen similar issues have been reported. But most of them talk about the metadata JSON not being published and hardly have any other useful information. The stack trace (if it can be called that) also contains surprisingly low amount of information.
Mention any other details that might be useful.
Link to the library used - https://github.com/abacritt/angular4-social-login