tailwind-hyperclay 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +8 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -34,13 +34,17 @@ export async function compileTailwind(html) {
34
34
  try {
35
35
  resolved = require.resolve(id, { paths: searchPaths });
36
36
  } catch {
37
- // If that fails, try with /index.css suffix (for package imports like "tailwindcss")
38
- resolved = require.resolve(`${id}/index.css`, { paths: searchPaths });
37
+ // If that fails, try resolving the package main entry and construct path to index.css
38
+ // This avoids subpath exports which can fail in Electron asar bundles
39
+ const mainEntry = require.resolve(id, { paths: searchPaths });
40
+ const pkgRoot = path.resolve(path.dirname(mainEntry), '..');
41
+ resolved = path.join(pkgRoot, 'index.css');
39
42
  }
40
43
 
41
- // If resolved to a JS file, try the CSS variant
44
+ // If resolved to a JS file, find package root and use index.css
42
45
  if (resolved.endsWith('.js') || resolved.endsWith('.mjs')) {
43
- resolved = require.resolve(`${id}/index.css`, { paths: searchPaths });
46
+ const pkgRoot = path.resolve(path.dirname(resolved), '..');
47
+ resolved = path.join(pkgRoot, 'index.css');
44
48
  }
45
49
 
46
50
  const content = await readFile(resolved, 'utf-8');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tailwind-hyperclay",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "On-save Tailwind CSS generator for Hyperclay",
5
5
  "type": "module",
6
6
  "main": "index.js",