Skip to content

Null pointer when used as bundle or compiled #19

Description

@phil294

Hello,

thanks for this tool, it works great! But not when bundled:

import { createCanvas, loadImage } from "https://raw.githubusercontent.com/DjDeveloperr/deno-canvas/master/mod.ts"

let canvas = createCanvas(200, 200)
let ctx = canvas.getContext("2d")
let img = await loadImage('img.jpg')
ctx.drawImage(img, 0, 0)

It works fine as deno run script.js. But when I deno bundle script.js bundle.js and deno run bundle.js or deno compile script.js (which presumably internally also calls deno bundle) and ./script, I get

error: Uncaught TypeError: Cannot read properties of undefined (reading 'MakeCanvas')
    return canvas.MakeCanvas(width, height);
                  ^
    at createCanvas (file:///b/some%20test/bundle.js:6752:19)
    at file:///b/some%20test/bundle.js:6754:15

Any idea why that could be? And how to solve it? Is it a Deno bug and should be reported there?

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions