Hey everyone, my catalog is ready on the Typesense...
# community-help
j
Hey everyone, my catalog is ready on the Typesense Cloud Server and I started implementing the frontend part following https://github.com/typesense/typesense-instantsearch-adapter. Except I cannot use node.js... Is it possible to use the TypesenseInstantSearchAdapter without node.js or not?
j
@John Doisneau If I understand you correctly, you essentially don't want to use npm to bundle things, correct? If so, you can just use the adapter standalone using the files in the dist directory. Here's a direct link to a file you can add within your script tag on the FE: https://cdn.jsdelivr.net/npm/typesense-instantsearch-adapter@1.1.1/dist/typesense-instantsearch-adapter.min.js
j
In fact I am trying to follow the example given here: https://github.com/typesense/typesense-instantsearch-demo - does this example still apply?
šŸ‘ 1
(The server I am on does not have and cannot have node.js)
j
You technically don't need node.js on the server. All you need is node.js in your developer environment. You'd use something like webpack to build on your local machine or CI server and push the final bundled JS file to your server
That example does use node / npm - but even that's something you only need to run on your local machine
To deploy, you'd run
npm run build
on your local machine and put the contents of the
dist
folder in your web servers public directory
j
OK, got it...
Thanks @Jason Bosco!
šŸ‘ 1
Ah, just one more thing @Jason Bosco: I actually tried to use the files: • typesense-instantsearch-adapter.min.js • typesense-instantsearch-adapter.min.js.map from https://github.com/typesense/typesense-instantsearch-adapter/tree/master/dist But I was getting various errors. Would these 2 files be sufficient or not?
j
It should be sufficient... What errors did you see?
j
Here is my search.html page
And my app.js
After about one hour of trials that did not work...
This is where I abandoned - it still does not work...
j
So you are using npm... Could you replicate this issue on say codesandbox.io, by uploading your project there? It would be easier to debug that way
Also, do you see the same error when you clone this repo: https://github.com/typesense/typesense-instantsearch-demo and just run:
Copy code
$ npm install
$ npm run typesenseServer
$ npm run populateTypesenseIndex
$ npm start
j
No, I am not using npm... I must have done some mistakes then - what am I doing wrong since I do not want to use it?
j
import TypesenseInstantSearchAdapter from './TypesenseInstantsearchAdapter.js';
This is only supported with a bundler like parcel / webpack (npm)
You want to remove that import line
And then in index.html add a new script tag, that includes
typesense-instantsearch-adapter.min.js
j
I had tried this - retried it now: app.js:4 Uncaught ReferenceError: TypesenseInstantSearchAdapter is not defined at app.js:4
j
Did you add the script tag to index.html? Could you share the exact tag you added?
j
<script src="typesense-instantsearch-adapter.min.js"></script>
<script type="module" src="./app.js"></script>
j
And
typesense-instantsearch-adapter.min.js
is on your local machine yeah? And you see no console 404 errors for that file?
j
I am working directly on my server. All files are there
No 404
This is my full setup
I would be very grateful if you could have a quick look, since it "should work"...
j
Yup, I'm looking into it
šŸ‘ 1
Found the issue. There was a build bug with the file in the dist directory, which I'm pushing a fix for shortly.
šŸ‘ 1
j
Great! Thanks @Jason Bosco!
j
j
Sure!
šŸ‘€ 1
Great, it works now!šŸ‘
šŸ™Œ 1
j
Awesome! Thank you for helping catch that. Somehow that build in dist directory broke between webpack upgrades...
šŸ‘ 1
šŸ™ 1
j
No worries, thank you!