使用webpack运行时未在vendor.js中定义事件

时间:2018-09-20 22:40:34

标签: angular webpack nativescript vendor

我正在尝试启动和运行Webpack,这是我面临的最后一个障碍(我希望)。我的项目使用命令构建

tns build android --bundle --env.uglify --env.aot --env.snapshot 

但是当我尝试运行项目时,它开始编译,但随后出现此错误

ReferenceError: Event is not defined
JS:     at t.patchEvent 
(file:///data/data/org.nativescript.LudusApp/files/app/vendor.js:1:601603)
JS:     at new t 
(file:///data/data/org.nativescript.LudusApp/files/app/vendor.js:1:601547)
JS:     at 
file:///data/data/org.nativescript.LudusApp/files/app/bundle.js:1:786884
JS:     at jo 
(file:///data/data/org.nativescript.LudusApp/files/app/vendor.js:1:82594)
JS:     at Mo 
(file:///data/data/org.nativescript.LudusApp/files/app/vendor.js:1:81929)
JS:     at Do 
(file:///data/data/org.nativescript.LudusApp/files/app/vendor.js:1:81764)
JS:     at Fo 
(file:///data/data/org.nativescript.LudusApp/files/app/vendor.js:1:82157)
JS:     at Mo 
(file:///data/data/org.nativescript.LudusApp/files/app/vendor.js:1:81890)
JS:     at Do 
(file:///data/data/org.nativescript.LudusApp/files/app/vendor.js:1:81764)
JS:     at Fo 
(file:///data/data/org.nativescript.LudusApp/files/app/vendor.js:1:82157)
JS:     at Mo 
(file:///data/data/org.nativescript.LudusApp/files/app/vendor.js:1:81890)
JS:     at Do (file:/...

我的vendor.ts文件看起来像这样

// Snapshot the ~/app.css and the theme
const application = require("application");
require("ui/styling/style-scope");
const appCssContext = require.context("~/", false, /^\.\/app\. 
(css|scss|less|sass)$/);
global.registerWebpackModules(appCssContext);
application.loadAppCss();

require("./vendor-platform");

require("reflect-metadata");
require("@angular/platform-browser");
require("@angular/core");
require("@angular/common");
require("@angular/forms");
require("@angular/http");
require("@angular/router");

require("nativescript-angular/platform-static");
require("nativescript-angular/forms");
require("nativescript-angular/router");

如果我的导入中缺少某些东西,这里是我的@NgModule

@NgModule({
  imports: [
    HttpModule,
    HttpClientModule,
    BrowserModule,   
    NativeScriptCommonModule,
    NativeScriptFormsModule,
    NativeScriptHttpModule,
    NativeScriptRouterModule,
    NativeScriptRouterModule.forRoot(routes),
    NativeScriptUIChartModule,
    DropDownModule,
    TNSCheckBoxModule
  ],

任何人都可以在之前看到问题所在或遇到类似问题吗?

0 个答案:

没有答案