Click here to Skip to main content
14,494,314 members
Rate this:
Please Sign up or sign in to vote.
See more:
Developed it using javascript but could not use that javascript as a chrome extension as importing youtube-dl modules renders errors.
When loaded as an extension in chrome browser, it shows following errors.
"Uncaught ReferenceError: require is not defined".

This is the sample code of my project where i get errors.

const express = require('express');
const cors = require('cors');
const ytdl = require('ytdl-core');
var http = require('http');
const app = express();

What I have tried:

I am developing a youtube video downloader extension for chrome browser. I have used javascript and youtube-dl for this purpose. Need your suggestions for this project as I am stuck in using that javascript program as a chrome extension.
Updated 24-Mar-20 23:33pm
Richard MacCutchan 25-Mar-20 5:16am
"Need your suggestions"
Try explaining in detail what actual problems you are facing. Use the Improve question link above to edit your question.
Richard MacCutchan 25-Mar-20 6:30am
The message is quite clear: Javascript does not recognise the term require.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100