0

I am trying to use ng2-file-upload in my app in this common way.

In my module.

import { FileUploadModule } from 'ng2-file-upload';

In systemjs config.

map: {
        ...
          'ng2-file-upload': '/static/node_modules/ng2-file-upload',
         ...
        }, 

        packages: {

          'ng2-file-upload': {
            main: 'ng2-file-upload.js',
            defaultExtension: 'js'
          }
        }  
      })

      SystemJS.import('main.js').then(function(m){
      }, function(error){
         console.log(error);
      });        

As a result, I am always getting this error.

Error: Unexpected value 'undefined' imported by the module 'AppModule'

But all js files downloaded correctly. I also tried index.js, bundles/ng2-file-upload.umd.js nothing works. Could you help me please?

zdimon77
  • 131
  • 10

1 Answers1

0

To eliminate this, I had to put that line in the index.js.

Object.defineProperty(exports, "__esModule", { value: true });

I don`t know is it a bug or I did something wrong?

zdimon77
  • 131
  • 10
  • what version of systemjs are you using? If 0.20.* then you need to specify under "meta" "ng2-file-upload": { "esModule": true }, – Steverob2k Jan 05 '18 at 16:22