Javascript 如何使用webpack导入angular2中的遗留js节点_模块文件

Javascript 如何使用webpack导入angular2中的遗留js节点_模块文件,javascript,import,angular,webpack,node-modules,Javascript,Import,Angular,Webpack,Node Modules,我有一个问题,我不能用Bootstrap导入Angular2中的BootstrapMenu。当我想用Webpack导入.js文件时遇到了困难 我在控制台中遇到此错误: Cannot find name 'BootstrapMenu' 我尝试按如下方式导入BootStrapMenu: import '../../../node_modules/bootstrap-menu/dist/BootstrapMenu.min.js'; 这是我的组件: import { Component } from

我有一个问题,我不能用Bootstrap导入Angular2中的BootstrapMenu。当我想用Webpack导入.js文件时遇到了困难

我在控制台中遇到此错误:

Cannot find name 'BootstrapMenu'
我尝试按如下方式导入BootStrapMenu:

import '../../../node_modules/bootstrap-menu/dist/BootstrapMenu.min.js';
这是我的组件:

import { Component } from '@angular/core';
import { ActivatedRoute } from '@angular/router';

import '../../../node_modules/bootstrap-menu/dist/BootstrapMenu.min.js';

console.log('`Dashboard` component loaded asynchronously');

@Component({
    selector: 'dashboard',
    templateUrl: 'dashboard.component.html'
})

export class Dashboard {
    localState;

    constructor(public route: ActivatedRoute) {

    }

    ngOnInit() {
        this.route
            .data
            .subscribe((data: any) => {
                this.localState = data.yourData;


     });
            console.log('hello `Dashboard` component');


            var menu = new BootstrapMenu('.line', {
                .....
                .......
                }
        });

    }
    asyncDataWithWebpack() {

    }
}
谢谢你的帮助