Skip to content
New issue

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

SyntaxError: Cannot use import statement outside a module #1

Open
ylohnitram opened this issue Jul 22, 2022 · 0 comments
Open

SyntaxError: Cannot use import statement outside a module #1

ylohnitram opened this issue Jul 22, 2022 · 0 comments

Comments

@ylohnitram
Copy link

`SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:360:18)
at wrapSafe (node:internal/modules/cjs/loader:1049:15)
at Module._compile (node:internal/modules/cjs/loader:1084:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47

Node.js v18.6.0`


`import CloudFlare from 'cloudflare-dns'
const cf = new CloudFlare({ token: 'XXX-TOKEN-XXX' });

const record = {
type: 'A',
name: 'example.com',
content: '127.0.0.1'
};

;(async function main() {
await cf.dns.update('XXX-ZONE-XXX', record)
})()`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant