Unable to export codes from one js file to other

hi guys, i am trying to export some code from one of my js files

to other but it is not working and showing some weird error both in my atom-terminal(cannot export outside the module) and cmd. I am using webpack and babel packages to bundle my files.
The above files are related to my code and my packages file and cmd error.

this is debug that cmd is pointing . How can I solve it?

Just an idea:

  • Upload your full project to https://repl.it/
  • It allows to use everything you’re using there AFAIK.
  • Be sure the console reproduces your current error/state.
  • Then we can test changes

bro i’m using various packages and json file and webpack.config.js
and babel file along with my dist and src folder how can I upload the entire project into it
and since the error is incomprehensible to me I thought the best way to share it will be through screenshots

Alright. It can be done, it will install all the dependencies in a remote computer, or smth like that. But hopefully someone will check the pics.

i tried to search my desired package but it wasn’t there

This might not be it, but can you try adding the extension to the file import (i.e. .js).

we don’t have to add extension to imported file path

btw i tried adding .js extension but it didn’t worked

So when I google for it, I get many results:


Which did you try and what happened?

i tried writing type = “module” in script tag. it gave me error of throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
you know what the most probable reason for my error according to me is this
answers 1st point, but I am not able to use it for my solution

look at this video i did exactly what it said but it ain’t helping me