を登録しません:Firebaseホスティングは私が作成したアプリの足場を持つポリマー
polymer init
その後、
{
"entrypoint": "index.html",
"shell": "src/my-app.html"
}
のように見えるpolymer.jsonファイルで:
firebase init
firebase.jsonのように見える:
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "build/bundled",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
Firebaseホスティングのサイトを開こうとすると、私はpolymer init
によって生成された最初のアプリの構造上polymer build
を実行してから、私は(JSコンソールで)これらのエラーを取得firebase deploy
とホスティングにプッシュする場合:
webcomponents-lite.js:1 Uncaught SyntaxError: Unexpected token <
webcomponents-lite.js:1 Uncaught SyntaxError: Unexpected token <
my-app.html:13 Uncaught ReferenceError: Polymer is not defined
参考のために、ここにindex.html
です:
<!doctype html>
<html>
<head>
<title>Snappy Title</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="manifest" href="/manifest.json">
<script src="/bower_components/webcomponentsjs/webcomponents-lite.js"></script>
<link rel="import" href="/src/my-app/my-app.html">
</head>
<body>
<my-app></my-app>
</body>
</html>
とmy-app.html
:
<link rel="import" href="../../bower_components/polymer/polymer.html">
<dom-module id="my-app">
<template>
<style>
:host {
display: block;
}
</style>
<h2>Hello [[prop1]]</h2>
</template>
<script>
Polymer({
is: 'my-app',
properties: {
prop1: {
type: String,
value: 'my-app',
},
},
});
</script>
</dom-module>
これらのファイルの両方がpolymer init
注意を経由して自動魔法のように作成されます。私はFirebaseホスティングを通じて非ビルドコードを提供している場合でも、エラーは同じまま。
polymer.jsonのincludeDependencies属性にwebcomponentsjsを追加すると、エラーが解決されました。ヒントをありがとう! – Lunchbox