Skip to content

Importing modules from relative paths fails for js/ts cells. Likely also for other languages. #2223

@seldomU

Description

@seldomU

This no longer works in Runner v2 but does in v1.

A typescript cell like this will fail, even with the imported file existing in the same directory as the runme file:

import foo from './bar.ts'

bar.ts source:

export default function() { console.log("hello!") }

The same issue should affect other languages for which runme creates a temporary file of the cell source code in a different directory.

Setting the cwd option does not help, because import paths are interpreted as relative to the source file location, not relative to the working directory.

A solution would be to create the temp file in the same directory as the runme file, or to turn that choice into a configuration option.

Alternatively, the cell content could be passed as a string to deno eval or node -e, which should run it as a temp file in the original directory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingrunnerv2

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions