Skip to content

Javascript import statements do not work #6

Open
@lennyerik

Description

@lennyerik

Minimal example:

test.js

import path from 'path';

test.py

from pathlib import Path

runs fine in Python, but throws the following error in Javascript:

<anonymous_script>:1
import path from 'path';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at file:///[...]/test.py.js:2:9
    at ModuleJob.run (node:internal/modules/esm/module_job:274:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:98:5)

Node.js v23.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions