我是聚合物新手,运行“polymer build”后出现以下问题,当我运行“polymer serve build / esm-bundled”时,浏览器中出现以下错误:
未捕获的 ReferenceError:未定义聚合物
我注意到,如果我禁用了 polymer.json 的包,则不会出现错误。
有人能帮助我吗?
我正在使用 Polymer-3 和 Redux,该项目最初是使用 polymer-2 构建的,但我进行了转换,并且在构建之前运行时效果很好。
这是聚合物.json
{
"entrypoint": "index.html",
"shell": "src/components/conversion-today-app/conversion-today-app.js",
"sources": [
"src/**/*",
"images/**/*",
"robots.txt",
"sitemap.xml",
"coinzilla-354635a9db1dbd05d0.txt"
],
"extraDependencies": [
"manifest.json",
"node_modules/web-animations-js/**",
"node_modules/@webcomponents/webcomponentsjs/**",
"node_modules/@polymer/polymer/**"
],
"builds": [
{
"name": "esm-bundled",
"browserCapabilities": [
"es2015",
"modules"
],
"js": {
"minify": true
},
"css": {
"minify": true
},
"html": {
"minify": true
},
"bundle": true,
"addServiceWorker": true
}
]
}
错误所在的组件的一部分
// Principais // Bibliotecas
import { PolymerElement,html } from '@polymer/polymer/polymer-element.js';
// import { html } from '@polymer/polymer/lib/utils/html-tag.js';
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
import { connect } from 'pwa-helpers/connect-mixin.js';
// pwa helper
import { installOfflineWatcher } from 'pwa-helpers/network.js';
// ---------- Redux ----------
// This element is connected to the redux store.
import { store } from '../../store.js';
// These are the actions needed by this element.
import { addCoin } from '../../actions/converter.js';
import converter from '../../reducers/converter.js';
import { fetchCrypto } from '../../actions/cryptoCoins.js';
import { fetchCurrencyState } from '../../actions/stateCoins.js';
// We are lazy loading its reducer.
import cryptoCoins from '../../reducers/cryptoCoins.js';
import stateCoins from '../../reducers/stateCoins.js';
store.addReducers({
stateCoins, cryptoCoins
});
// Componentes de Terceiros
import '@polymer/paper-fab/paper-fab.js';
import '@polymer/paper-dialog/paper-dialog.js';
import '@polymer/paper-dropdown-menu/paper-dropdown-menu-light.js';
import '@polymer/paper-dropdown-menu/paper-dropdown-menu.js';
import '@polymer/paper-button/paper-button.js';
import '@polymer/iron-demo-helpers/demo-snippet.js';
import '@polymer/iron-demo-helpers/demo-pages-shared-styles.js';
import '@polymer/paper-item/paper-item.js';
import '@polymer/paper-listbox/paper-listbox.js';
import '@polymer/iron-ajax/iron-ajax.js';
import '@polymer/app-storage/app-localstorage/app-localstorage-document.js';
// Components locais
import '../elements/collection-coin-element.js';
class ConversionTodayConverter extends connect(store)(PolymerElement) {
static get template() {
return html`
<style include="demo-pages-shared-styles">
:host {
display: block;
padding: 10px;
}
paper-fab {
--paper-fab-background: #2B4461;
display: inline-block;
/* margin: 8px; */
position: fixed;
right: 25px;
bottom: 30px;
}
</style>
<app-localstorage-document key="conversion-today-coins" data="{{coins}}">
</app-localstorage-document>
浏览器——错误