I build a chrome extension project using webpack and I need to read a local bundle file from content script this way:
const fs = require('fs');
const path = require('path');
const content = fs.readFileSync(
path.join(__dirname, 'inpage.js'),
'utf8',
);
But fs is undefined in my build, so the question is How can I successfuly build project with the fs in the content script OR how can I include the raw xxx.bundle.js file into my content script to use it as string?
P.S. indefined fs is a popular issue, but there is no answer that helped me. But I know it's possible because some extensions can do this.