Deno: Deno bundle fails when invalid URIs/imports are found in comments

Created on 23 Apr 2020  Â·  4Comments  Â·  Source: denoland/deno

Version:

deno 0.41.0
v8 8.2.308
typescript 3.8.3

How to reproduce:
deno bundle https://unpkg.com/@vaadin/[email protected]/dist/vaadin-router.js output.js
The following error is produced:

error: Uncaught URIError: relative import path "my-view.js" not prefixed with / or ./ or ../ Imported from "https://unpkg.com/@vaadin/[email protected]/dist/vaadin-router.js"
â–º $deno$/ops/dispatch_json.ts:43:11
    at unwrapResponse ($deno$/ops/dispatch_json.ts:43:11)
    at Object.sendSync ($deno$/ops/dispatch_json.ts:72:10)
    at Object.resolveModules ($deno$/ops/compiler.ts:11:10)
    at resolveModules ($deno$/compiler/imports.ts:63:22)
    at processImports ($deno$/compiler/imports.ts:147:27)
    at Object.processImports ($deno$/compiler/imports.ts:156:13)
    at async compile (file:///Users/runner/runners/2.169.0/work/deno/deno/cli/js/compiler.ts:131:31)
    at async tsCompilerOnMessage (file:///Users/runner/runners/2.169.0/work/deno/deno/cli/js/compiler.ts:338:22)
    at async workerMessageRecvCallback ($deno$/runtime_worker.ts:62:9)

deno bundle appears to get caught up on this part of https://unpkg.com/@vaadin/router@1.7.1/dist/vaadin-router.js:

// Actions like `() => import('my-view.js')` are not expected to
// end the resolution, despite the result is not empty. Checking
// the result with a whitelist of values that end the resolution.

When this chunk of comments is removed from a local version of the file and deno bundle is attempted again it works without issue.

Desired behavior:
Deno bundle should ignore comments while looking for imports.

Also, thank you for creating such an incredible tool!

bug

Most helpful comment

Thanks for the report - this is definitely a bug. We have a couple regular expressions that pass over the code - we need to change these to use the actual AST.

All 4 comments

Thanks for the report - this is definitely a bug. We have a couple regular expressions that pass over the code - we need to change these to use the actual AST.

Correct, duplicate #4464 which is a duplicate of #3089, it has nothing to do with the code in the comments, it has to do with using the string literal markings. It is really https://github.com/microsoft/TypeScript/issues/30878. Can we close this and #4464 both in favour of #3089? I have chased the TypeScript defect, but will likely take a look at it myself since it is largely being ignored.

Closing in favor of #3089

Was this page helpful?
0 / 5 - 0 ratings

Related issues

metakeule picture metakeule  Â·  3Comments

ry picture ry  Â·  3Comments

kyeotic picture kyeotic  Â·  3Comments

ry picture ry  Â·  3Comments

doutchnugget picture doutchnugget  Â·  3Comments