0

I am having an app using d3.js, when I compile the code using rollup, I got this error in browser,

Uncaught TypeError: Cannot read property 'document' of undefined

It is something like this from d3.js:

!function() {
  var d3 = {
    version: "3.5.17"
  };
  var d3_arraySlice = [].slice, d3_array = function(list) {
    return d3_arraySlice.call(list);
  };
  var d3_document = this.document;

I googled and seemed it is something related to: "useStrict"

But how can I disable it in tsconfig or rollup procedure?

Thanks

user3006967
  • 3,291
  • 10
  • 47
  • 72
  • I think the `this` does not refer to the same thing when using AoT. Normally it refers to the `window` I think, with AoT it refers to the instance of the function. I think this is one of the reasons why direct-dom access is discouraged in angular2 – eko Apr 10 '17 at 04:43
  • I have to manually remove 'use strict' from build.js, then it can pass. – user3006967 Apr 10 '17 at 15:34

0 Answers0