Closed estradamarkie closed 8 years ago
all cool, but ng2-bootstrap uses moment.js for datepicker
you can check system.js quickstart for configuration details https://github.com/valor-software/angular2-quickstart
Oh so even though you're not using datepicker, momentjs is still required?
Nvm, its all good now thanks Valorkin
on my opinion it should not, but... for some reason it is
in worst case I will move datepicker out of bootstrap
I am using datepicker and have run into this problem. @estradamarkie @valorkin The solution for me is to go into node_modules/ng2-bootstrap/components/datepicker/date-formatter.js and change:
var moment = require('moment');
to
var moment = require('../../../moment/moment');
assuming you have moment.js installed
this is wrong var moment = require('../../../moment/moment');
webpack?
I hope you are using npm 3?
Yeah 3.10.3. It seems weird that I have to do that. Just yesterday I removed node-modules and reinstalled all of my packages and still had to make that change. Relative code:
var map = {
'moment': 'node_modules/moment',
var packages = {
'moment': { defaultExtension: 'js' },
"dependencies": {
"moment": "2.14.1",
}
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": false
},
"exclude": [
"typings/browser.d.ts",
"typings/browser",
"node_modules"
]
}
<!-- 2. Configure SystemJS -->
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err){ console.error(err); });
</script>
@quiringk this should help https://github.com/valor-software/angular2-quickstart/blob/master/systemjs.config.js#L8
Yeah that did it, thanks
Hi, I've installed ng2-bootstrap using npm install and set up my config like the code below. However when I do that it keep asking me moment.js is not found even though I'm not using momentjs anywhere in my app. I need ng2-bootstrap for the carousel i'm working on, if I don't update the configsystem console.log will say ng2-bootstrap (not found).
System.config({ defaultJSExtensions: true, packages: { app: { format: 'register', defaultExtension: 'js' } }, paths: { 'ng2-bootstrap': 'node_modules/ng2-bootstrap/ng2-bootstrap', } });