We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to import some public functions from another js file. But an error Cannot use import statement outside a module happened. How to fix this?
Cannot use import statement outside a module
The text was updated successfully, but these errors were encountered:
Hi @boybeak find the examples below you can use the reference of the file JavaScript const myModule = require('./otherFile');
const myModule = require('./otherFile');
JavaScript1
export function greet(name) { return `Hello, ${name}!`; }
JavaScript2
import { greet } from './first.js'; console.log(greet('World'));
Sorry, something went wrong.
No branches or pull requests
I want to import some public functions from another js file. But an error
Cannot use import statement outside a module
happened. How to fix this?The text was updated successfully, but these errors were encountered: