Skip to content

[QUERY] How to deploy with npm module dependencies? #89

@oeed

Description

@oeed

Question

I am trying to use an npm module as there is no native Deno equivalent. I am trying to convert GitHub markdown to Slack's custom markdown format (if there's another way to do this please let me know!).

import slackifyMarkdown from "npm:slackify-markdown"

This works perfectly locally with slack run. However, when deploying I get a bunch of errors from deno_esbuild relating to resolving sub-dependencies. For example:

✘ [ERROR] NPM package not found. [plugin deno-loader]
    ../../../../Library/Caches/deno/deno_esbuild/remark-gfm@1.0.0/node_modules/remark-gfm/index.js:3:21:
      3 │ var syntax = require('micromark-extension-gfm')
        ╵                      ~~~~~~~~~~~~~~~~~~~~~~~~~
✘ [ERROR] NPM package not found. [plugin deno-loader]
    ../../../../Library/Caches/deno/deno_esbuild/remark-parse@9.0.0/node_modules/remark-parse/index.js:5:27:
      5 │ var fromMarkdown = require('mdast-util-from-markdown')
✘ [ERROR] Import 'https://./exists.ts' failed: error sending request for url (https://./exists.ts): error trying to connect: invalid dnsname [plugin deno-loader]
    https://deno.land/std@0.67.0/fs/move.ts:2:35:
      2 │ import { exists, existsSync } from "./exists.ts";
        ╵                                    ~~~~~~~~~~~~~
✘ [ERROR] Import 'https://../path/mod.ts' failed: error sending request for url (https://../path/mod.ts): error trying to connect: invalid dnsname [plugin deno-loader]
    https://deno.land/std@0.67.0/fs/ensure_link.ts:2:22:
      2 │ import * as path from "../path/mod.ts";

The strange thing is, it seems to resolve direct dependencies of slackify-markdown such as remark-gfm okay, but not their dependencies. Additionally, all the dependency files are indeed in the Deno cache folder, so I don't know why it's not resolving them. I haven't used Deno before so apologies if this is obvious!

Screenshot 2024-07-01 at 11 18 45

Environment

The deno-slack versions
deno_slack_sdk: 2.12.0
deno_slack_api: 2.4.0

Deno runtime version
CLI: 2.26.0
deno: 1.44.4
typescript: 5.4.5
v8: 12.6.228.9

OS info

macOS 14.5

Requirements

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions