简体   繁体   中英

ng2-file-upload with Angular 4 and SystemJS

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?

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM