Open KyleJune opened 2 years ago
I had a similar relative import path issue with another module of mine too.
https://esm.sh/@twind/preset-tailwind@1.0.0-next.38?target=deno&pin=v85
error: Relative import path "twind" not prefixed with / or ./ or ../ and not in import map from "https://esm.sh/v85/@twind/preset-tailwind@1.0.0-next.38/preset-tailwind.d.ts"
When I checked that file, I found the import path is the same as it is originally before esm transformation. I believe 'twind' should have been replaced with a url to the esm module for it.
import { BaseTheme, MaybeArray, CSSProperties, Preset } from 'twind';
Adding "twind": "https://esm.sh/twind@1.0.0-next.38?target=deno&pin=v85",
to the import map used for vendoring resolves that issue.
@KyleJune thanks for reporting! i guess the vendor error was caused by deno CLI, can you please create a pr for deno repo?
import { BaseTheme, MaybeArray, CSSProperties, Preset } from 'twind';
yes, this types is incorrect, i will fix it asap!
@KyleJune thanks for reporting! i guess the vendor error was caused by deno CLI, can you please create a pr for deno repo?
I think it's this line in the esm file that is causing the issue though. This export doesn't look valid but If I'm mistaken I'll go ahead and create an issue on the deno repo.
export = React;
@KyleJune thanks for reporting! i guess the vendor error was caused by deno CLI, can you please create a pr for deno repo?
I think it's this line in the esm file that is causing the issue though. This export doesn't look valid but If I'm mistaken I'll go ahead and create an issue on the deno repo.
export = React;
The React
is a namespace defined below:
// tslint:disable-next-line:export-just-namespace
export = React;
export as namespace React;
declare namespace React {
function createElement()
...
}
@KyleJune thanks for reporting! i guess the vendor error was caused by deno CLI, can you please create a pr for deno repo?
I think it's this line in the esm file that is causing the issue though. This export doesn't look valid but If I'm mistaken I'll go ahead and create an issue on the deno repo.
export = React;
The
React
is a namespace defined below:// tslint:disable-next-line:export-just-namespace export = React; export as namespace React; declare namespace React { function createElement() ... }
Done.
I ran into a similar issue, not sure if I should create a separate bug report for this.
When trying to vendor https://esm.sh/clean-css@5.3.0 and now also I ran into a Relative import path "http" not prefixed with / or ./ or ../
error.
The reason seems to be that many node type files contain something like:
declare module 'events' {
// ...
}
declare module 'https://esm.sh/v87/@types/node/events.d.ts' {
import events = require('events');
export = events;
}
in https://esm.sh/v87/@types/node/events.d.ts for example.
I have opened https://github.com/denoland/deno/issues/15206
Failing module
Error message
deno run works even with --check=all, but if I try vendoring the module with deno vendor it fails because of the import path.
After running
deno vendor example.ts
I got this:Additional info
If you open up that file, you'll find client~.d.ts is using
import React = require('react');
.If I add the following import map and run vendor with it, vendor works.
But if I run it with the import map generated by the vendor command, I get the following error. I don't get the error when not using the vendored module.
Another issue I had with
deno vendor
and esm.sh but don't have a minimal reproduction path is shown below. When I run my application without vendoring, it works fine but when I vendor it I get this error from esm types.I looked at the file and found the following lines, I believe they are responsible for the above error.