无法在离子应用程序内部构建聚合物Web组件

时间:2019-03-07 16:28:31

标签: angular ionic-framework polymer web-component polymer-3.x

我正在尝试在Ionic(也是v3)应用程序中使用自定义的Polymer(v3)组件。

如果我与ionic cordova run android一起运行,该组件可以正常工作。

但是当我尝试使用--prod标志运行时,该项目会在我的手机中编译并打开,但它根本不会显示该组件。

chrome检查工具中显示的错误如下:

Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object contructor cannot be called as a function.

这是我的package.json:

{
  "name": "testApp",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "start": "ionic-app-scripts serve",
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint"
  },
  "dependencies": {
    "@angular/animations": "4.1.3",
    "@angular/common": "4.1.3",
    "@angular/compiler": "4.1.3",
    "@angular/compiler-cli": "4.1.3",
    "@angular/core": "4.1.3",
    "@angular/forms": "4.1.3",
    "@angular/http": "4.1.3",
    "@angular/platform-browser": "4.1.3",
    "@angular/platform-browser-dynamic": "4.1.3",
    "@babel/core": "^7.3.4",
    "@ionic-native/core": "4.8.0",
    "@ionic-native/device": "4.8.0",
    "@ionic-native/screen-orientation": "4.8.0",
    "@ionic-native/splash-screen": "4.8.0",
    "@ionic-native/status-bar": "4.8.0",
    "@ionic/app-scripts": "2.0.2",
    "@ionic/storage": "2.0.1",
    "cordova-android": "7.0.0",
    "cordova-plugin-device": "^1.1.7",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^3.1.2",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "ionic-angular": "3.9.3",
    "ionicons": "3.0.0",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "tsc-wrapper": "^2.0.0",
    "my-polymer-component": "^1.3.0",
    "zone.js": "0.8.29"
  },
  "devDependencies": {
    "@ionic/app-scripts": "2.0.2",
    "tslint-ionic-rules": "0.0.21",
    "typescript": "2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
      },
      "cordova-plugin-ionic-keyboard": {}
    },
    "platforms": [
      "android"
    ]
  }
}

我尝试将webcomponents添加到我的index.html中,但仍然没有成功。

0 个答案:

没有答案