I have this flow of files.
In container.jsx component I import the udf-compatible-datafeed.js file like this
_createChart(){
const UDFCompatibleDatafeed = (await import("./datafeeds/udf/src/udf-compatible-datafeed")).default;
}
This import failed and this gives me an error
Error: jQuery was not found. Please ensure jQuery is referenced before the SignalR client JavaScript file.
The error comes from this data-pluse-provider file
import { logMessage, } from './helpers';
import $ from 'jquery';
require('signalr');
window.jQuery = $;
const DataPulseProvider = function(){};
export {DataPulseProvider}
This file requires jQuery. I think due to SSR reasons. window object may not be defined here.
I can't use nextjs dynamic imports here as well. Because this is a JavaScript file, not a jsx component.
But from the index.jsx component I import the component with next js dynamics and for the ContainerPage as well. But the error is still there.
How can I fix this with next.js? Any help!
Thanks in advance.