Description
Hello, first of all I'm sorry if I don't follow the format you request for the reply, but I've gone mad all evening trying to make the following work and I'm tired, so I'll understand if noone replies:
Angular 2 app
Use moment.js and lodash
Compile AOT and use rollup to bundle.
Everything latest version from npm.
Initially Rollup was complaining about "cannot call a namespace", caused by this:
import * as moment from "moment"
Then I changed to
import moment from "moment"
tsc wouldn't compile until I turned on the "allowSyntheticDefaultImports" flag.
So I did, and it compiled. And Rollup now works!
But,
the generated code for
import moment from "moment"; ... console.log(moment().toDate());
is not what I'd expect, which would be
var moment_1 = require("moment"); ... console.log(moment_1().toDate())
but it actually is
var moment_1 = require("moment"); ... console.log(moment_1.default().toDate())
So I read tons of discussions around the web, and in this repo as well, but I'm pretty confused still, there's no good and definitive documentation... shouldn't the flag I activated prevent the .default() function call on moment??
I'm sorry but I'm not as good with js and modules to understand fully what is going on.
And I find it astonishing that so little people have problems doing a simple thing: using globals from pervasive libraries in an application built with external modules. I want to make modules for the code I write but lodash moment jquery and stuff are always present in the page... I don't want to load lodash as an import as I want to be able to open the dev tools and type _.find(...) in the console, I need it global, and I'm sure I'm not the only one...
Thanks in advance to whoever will help me understand. And I hope using TypeScript will get easier for common scenarios...
TypeScript Version: 2.0.10