We mentioned jquery library file in template.html in PWA Venia setup as below :
<script async src="//asset.fwcdn3.com/js/embed-feed.js" type="text/javascript" ></script>
We are using that library file in below path
src/components/Homepage/components – FireWork.js
import React from "react";
import HeadTitle from './HeadTitle';
const FireWork = () => {
return(
<div class="">
<HeadTitle title={'Shop By Look'} textAlign={'center'} />
<fw-embed-feed
channel="glow"
autoplay="true">
</fw-embed-feed>
<br/>
</div>
);
}
export default FireWork;
Issue :
It’s working fine. but is it wrong to insert a jquery library file directly in a template.html file? do we need use import ? so i tried as below :
I created new file : initialize-fire.js
const initializeFire = () => {
let script = document.createElement('script');
script.src = "//asset.fwcdn3.com/js/embed-feed.js";
script.async = true;
script.onload = scriptOnLoad;
document.body.append(script);
};
and inserted the below line in firework.js :
import { initializeFire } from '../../initialize-fire.js';
but it giving error : module not found
Firework.js : https://pastebin.com/utfXgFLc