Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2, Webpack Uncaught ReferenceError: vendor... is not defined when add an external lib

When I add a library (in my case it is jplayer) I got error

external "vendor_d73928c…":1 Uncaught ReferenceError: vendor_d73928c989153b363873 is not defined

at line module.exports = vendor_d73928c989153b363873 in file webpack:///external "vendor_d73928c989153b363873"

Here is my code (which add vendor jplayer).

entry: {
    vendor: [
        'bootstrap',
        'bootstrap/dist/css/bootstrap.css',
        'font-awesome/css/font-awesome.css',
        'style-loader',
        'jquery',
        '@angular/common',
        '@angular/compiler',
        '@angular/core',
        '@angular/http',
        '@angular/platform-browser',
        '@angular/platform-browser-dynamic',
        '@angular/router',
        '@angular/platform-server',
        'angular2-google-maps/core',
        'jplayer'
    ]
},

Do I missing something?

like image 420
Phan Hoàng Nhân Avatar asked Jul 28 '16 10:07

Phan Hoàng Nhân


1 Answers

I found the solution. Just exit visual studio, run webpack --config webpack.config.vendor.js webpack in cmd, in the project folder. After that, open visual studio again

like image 195
Phan Hoàng Nhân Avatar answered Nov 14 '22 22:11

Phan Hoàng Nhân