I have a React application that I try to import a module registered as a SystemJS module using the following code snippet.
import System from 'systemjs';
const imported_module;
System.import("https://example.js")
.then((module) => {
// Use the module
imported_module = module;
})
.catch((error) => {
console.error('Error loading the module:', error);
});
However, when I try to import it I get the following error even though I have installed systemjs npm module.
ERROR in ./node_modules/systemjs/dist/system-node.cjs
Module not found: Error: Can't resolve 'fs' in '/node_modules/systemjs/dist'
@ ./node_modules/systemjs/dist/system-node.cjs 7785:17-30
@ ./src/index.js
Can anybody figure out what am I doing wrong here?