polymer - Polymer 3 build - 尝试访问 mixin 时浏览器中的捆绑错误
问题描述
我有一个可以正常工作的 Polymer 3 应用程序。但是,如果我构建并捆绑它,我会在捆绑时遇到问题。我现在只做es6。我什至不知道如何解决这个问题......非常卡住。
聚合物.json
"builds": [
{
"name": "es6-bundled",
"browserCapabilities": [
"es2015"
],
"js": {
"minify": false,
"transformModulesToAmd": true
},
"css": {
"minify": false
},
"html": {
"minify": false
},
"bundle": true,
"addServiceWorker": false
}
],
浏览器错误:
all-items:formatted:211 Uncaught TypeError: (0 , _mainApp.PauseForRipple) is not a function
at user-login.js? [sm]:4
捆绑包中的代码:
define(["../main-app.js"], function(_mainApp) {
"use strict";
class UserLogin extends (0,
_mainApp.PauseForRipple)(_mainApp.PolymerElement) {
static get template() {
return _mainApp.html`
<style>
:host {
display: flex;
align-items: center;
构建前的原始代码:
import { PauseForRipple } from '../mixins/pause-for-ripple-mixin.js';
class UserLogin extends PauseForRipple(PolymerElement) {
static get template() {
return html`
<style>
:host {
display: flex;
align-items: center;
justify-content: center;
解决方案
根本原因是我有双重导入导入'./login/user-login.js'; 在 main-app.js 中。
推荐阅读
- recursion - Erlang、Last Call Optimization、lambda 函数以及如何防止堆栈增长
- node.js - 如何在 cPanel 上托管节点反应 Web 应用程序?
- python - 如何在python中使用其他文件的字符串打开文件?
- java - 保护 JMX 并防止远程客户端使用 javax.management.loading.MLet 注册任意 Mbeans JMX
- regex - 匹配包含混合文本和数字的 URL 产品着陆页,同时排除产品变体
- fabricjs - Fabric.js 版本 2.x getActiveGroup() 折旧和破坏应用程序
- php - 任务正在删除,但页面需要重新引用
- r - highcharter 在悬停时更改突出显示颜色
- php - 如何在 WampServer 中为不同的 PHP 版本创建不同的 php.ini 文件?
- python - Python scraper:如何进入配置文件并提取数据