denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.21k stars 5.41k forks source link

Bug: tailwindcss v4 alpha errors on import #22801

Open marvinhagemeister opened 8 months ago

marvinhagemeister commented 8 months ago
import tailwindcss from "npm:@tailwindcss/postcss@4.0.0-alpha.6";
console.log(tailwindcss);

Error:

error: Could not resolve 'npm:@tailwindcss/postcss@4.0.0-alpha.6'.

Caused by:
    0: Failed resolving package subpath '.' for '/Users/marvinh/dev/test/deno-tw2/node_modules/.deno/@tailwindcss+postcss@4.0.0-alpha.6/node_modules/@tailwindcss/postcss/package.json'
    1: [ERR_INVALID_PACKAGE_TARGET] Invalid "exports" main target {"types":"./dist/index.d.ts","require":"./dist/index.js"} defined in the package config /Users/marvinh/dev/test/deno-tw2/node_modules/.deno/@tailwindcss+postcss@4.0.0-alpha.6/node_modules/@tailwindcss/postcss/package.json imported from file:///Users/marvinh/dev/test/deno-tw2/foo.ts; target must start with "./"

Version: Deno 1.41.1

kt3k commented 4 days ago

Looks like this was fixed in upstream. The package doesn't error at v4.0.0-beta.2:

$ cat a.js 
import tailwindcss from "npm:@tailwindcss/postcss@4.0.0-beta.2";
console.log(tailwindcss);
$ deno -A a.js 
[Function: A] { postcss: true }