Closed RSginer closed 6 years ago
Hi @RSginer you need to add them inside the systemjs.config.js
follow the other npm modules like rxjs and angular
Thanks for the answer @izifortune.
this is my systemjs.config.js
'use strict';
/**
* System configuration for Angular samples
* Adjust as necessary for your application needs.
*/
(function () {
System.config({
paths: {
// paths serve as alias
'npm:': '../node_modules/'
},
// map tells the System loader where to look for things
map: {
// our app is within the app folder
app: 'app',
// angular bundles
'@angular/core': 'npm:@angular/core/bundles/core.umd.js',
'@angular/common': 'npm:@angular/common/bundles/common.umd.js',
'@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
'@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
'@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
'@angular/http': 'npm:@angular/http/bundles/http.umd.js',
'@angular/router': 'npm:@angular/router/bundles/router.umd.js',
'@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
// other libraries
moment: 'npm:moment',
rxjs: 'npm:rxjs',
'angular-in-memory-web-api': 'npm:angular-in-memory-web-api/bundles/in-memory-web-api.umd.js',
'ngx-messenger': '../dist'
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
app: {
defaultExtension: 'js',
meta: {
'./*.js': {
loader: 'systemjs-angular-loader.js'
}
}
},
rxjs: {
defaultExtension: 'js'
},
'ngx-messenger': {
main: 'ngx-messenger.umd.js',
defaultExtension: 'js'
}
}
});
})(this);
and when npm run playground
:
[0] 'moment' is imported by build/messenger-message.component.js, but could not be resolved – treating it as an external dependency
[0] No name was provided for external module '@angular/core' in options.globals – guessing 'core'
[0] No name was provided for external module '@angular/common' in options.globals – guessing 'common'
[0] No name was provided for external module 'moment' in options.globals – guessing 'moment'
[0] [20:45:35] Finished 'rollup:umd' after 67 ms```
@RSginer Try to add moment this way:
'moment': 'npm:moment/moment.js'
@izifortune its working thanks!
@RSginer — Thank you for the confirmation 👍 @izifortune — Thank you for your help 🏆
Hello im working in a angular library for chats and i want to add other libraries moment in this case but i dont know how i should make this, i add moment in the peerDependencies but the playground is not compiling correctly (is my first time using playground sorry)
the library: https://github.com/RSginer/ngx-messenger
Please add in the wiki or readme a guide to use other dependencies inside our libraries and configure playground to test it