Skip to content

Allow TypeScript files to be imported from npm packages #24093

Closed as not planned
@kruncher

Description

I am getting the following error when attempting to import a .ts file from an npm package (byonm):

TypeScript files are not supported in npm packages:

import { foo } from "some-node-module/abc.ts";
foo();

The source of the above error seems to be this: https://github.com/denoland/deno/blob/main/ext/node/resolution.rs#L454

There is a lot that I really like about deno but there are many scenarios where I want to be able to depend upon an entire package of files (scripts, stylesheets, templates, static assets, etc). There are many reasons where I find this to be useful; one such example is that of a reusable component library containing nunjucks templates and .scss files which can then be reused as a package across multiple services.

I would like to be able to reference a node module and then to import TypeScript files as-is and to be able to configure nunjucks to read templates from a directory structure from a package, and to be able to process .scss files where some are imported from a package.

In the node world npm packages quite easily allow for this and I think deno could potentially allow for this with its byonm feature. (As an aside I prefer to reference my own packages from GitHub repositories rather than publishing them to the npm registry).

Metadata

Assignees

No one assigned

    Labels

    duplicatea duplicate of another issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions