Skip to content

Provide util for generating import paths from file paths #2146

@aklinker1

Description

@aklinker1

Feature Request

In some cases, simple string interpolation is not good enough when importing an absolute file path, as mentioned in the original issues mentioned below.

We should provide a util from wxt/module for converting file paths to import paths. It should support windows paths and unix paths, as well as escape ' and other characters in paths.

Proposed APIs:

import { formatImportPath } from 'wxt/modules'

Is your feature request related to a bug?

Follow up to #2143 and #1697.

What are the alternatives?

Use a package or existing API?

Additional context

Add any other context or screenshots about the feature request here.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions