[go: nahoru, domu]

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

deno bundle silently drops npm dependencies #16635

Closed
mcodik opened this issue Nov 14, 2022 · 0 comments · Fixed by #16637
Closed

deno bundle silently drops npm dependencies #16635

mcodik opened this issue Nov 14, 2022 · 0 comments · Fixed by #16637
Labels
bug Something isn't working correctly cli related to cli/ dir

Comments

@mcodik
Copy link
mcodik commented Nov 14, 2022

I understand that npm module specifiers arent supported yet in deno bundle in 1.28.0, and I see its TODO in #15960.

However, if you try to use deno bundle on a script with an npm module import, it emits a bundle with the dependency missing, so if you try to execute the bundle you get a runtime error.

Can deno bundle can fail with an error code when it encounters npm module specifiers until support is added?

example code, which works fine in deno run:

import _ from "npm:lodash@4.17.21";

const salutations = ["Hello", "Hi", "Howdy", "Hola", "Salut"];
const salutation = _.sample(salutations);
console.log(salutation);

deno bundle output:

// deno-fmt-ignore-file
// deno-lint-ignore-file
// This code was bundled using `deno bundle` and it's not recommended to edit it manually

const salutations = [
    "Hello",
    "Hi",
    "Howdy",
    "Hola",
    "Salut"
];
const salutation = __default.sample(salutations);
console.log(salutation);

which fails at runtime because __default is undefined

@ry ry added bug Something isn't working correctly cli related to cli/ dir labels Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants