|
20 | 20 | <script src="../../../src/index.js"></script> |
21 | 21 | <script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4"></script> |
22 | 22 | <script> |
23 | | - console.log(instantMeiliSearch) |
24 | | - instantMeiliSearch = instantMeiliSearch.default |
25 | | - const search = instantsearch({ |
26 | | - indexName: "steam-video-games", |
27 | | - searchClient: instantMeiliSearch( |
28 | | - "https://demos.meilisearch.com", |
29 | | - "dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25", |
30 | | - ) |
31 | | - }); |
32 | | - search.addWidgets([ |
33 | | - instantsearch.widgets.searchBox({ |
34 | | - container: "#searchbox", |
35 | | - placeholder: "Search..", |
36 | | - }), |
37 | | - instantsearch.widgets.configure({ |
38 | | - hitsPerPage: 8, |
39 | | - }), |
40 | | - instantsearch.widgets.hits({ |
41 | | - container: "#hits", |
42 | | - templates: { |
43 | | - item: ` |
44 | | - <div> |
45 | | - <div class="hit-name"> |
46 | | - {{#helpers.highlight}}{ "attribute": "name" }{{/helpers.highlight}} |
47 | | - </div> |
48 | | - </div> |
49 | | - ` |
50 | | - } |
51 | | - }) |
52 | | - ]); |
53 | | - |
54 | | - search.start(); |
| 23 | + // This is due to parcel not accepting globals on html files. |
| 24 | + instantMeiliSearch = instantMeiliSearch.instantMeiliSearch; |
| 25 | + const search = instantsearch({ |
| 26 | + indexName: "steam-video-games", |
| 27 | + searchClient: instantMeiliSearch( |
| 28 | + "https://demos.meilisearch.com", |
| 29 | + "dc3fedaf922de8937fdea01f0a7d59557f1fd31832cb8440ce94231cfdde7f25", |
| 30 | + ) |
| 31 | + }); |
| 32 | + search.addWidgets([ |
| 33 | + instantsearch.widgets.searchBox({ |
| 34 | + container: "#searchbox", |
| 35 | + placeholder: "Search..", |
| 36 | + }), |
| 37 | + instantsearch.widgets.configure({ |
| 38 | + hitsPerPage: 8, |
| 39 | + }), |
| 40 | + instantsearch.widgets.hits({ |
| 41 | + container: "#hits", |
| 42 | + templates: { |
| 43 | + item: ` |
| 44 | + <div> |
| 45 | + <div class="hit-name"> |
| 46 | + {{#helpers.highlight}}{ "attribute": "name" }{{/helpers.highlight}} |
| 47 | + </div> |
| 48 | + </div> |
| 49 | + ` |
| 50 | + } |
| 51 | + }) |
| 52 | + ]); |
| 53 | + search.start(); |
55 | 54 | </script> |
56 | 55 | </body> |
57 | 56 | </html> |
58 | | - |
0 commit comments