Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unable to resolve preset from published config #412

Closed
JeffBeltran opened this issue Sep 20, 2021 · 5 comments
Closed

unable to resolve preset from published config #412

JeffBeltran opened this issue Sep 20, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@JeffBeltran
Copy link

I ran into the same issue as #333, However, im trying to reference a published preset (Github package). Tailwind has no issues with this, but in vscode this extension crashes

  presets: [require("@homevalet/bowtie/config")],
  mode: "jit",
  purge: [
    "./index.html",
    "./src/**/*.{vue,js,ts,jsx,tsx}",
    "./node_modules/@homevalet/bowtie/**/*",
  ],

but the extension throws the following error

[Error - 3:04:52 PM] Tailwind CSS: Can't resolve '@homevalet/bowtie/config' in '/Users/jeffbeltran/code/vite-project'
Error: Can't resolve '@homevalet/bowtie/config' in '/Users/jeffbeltran/code/vite-project'
    at c (/Users/jeffbeltran/.vscode/extensions/bradlc.vscode-tailwindcss-0.6.14/dist/server/tailwindServer.js:2:26552)
    at /Users/jeffbeltran/.vscode/extensions/bradlc.vscode-tailwindcss-0.6.14/dist/server/tailwindServer.js:2:27239
    at /Users/jeffbeltran/.vscode/extensions/bradlc.vscode-tailwindcss-0.6.14/dist/server/tailwindServer.js:2:27803
    at eval (eval at create (/Users/jeffbeltran/.vscode/extensions/bradlc.vscode-tailwindcss-0.6.14/dist/server/tailwindServer.js:50:32334), <anonymous>:15:1)
    at /Users/jeffbeltran/.vscode/extensions/bradlc.vscode-tailwindcss-0.6.14/dist/server/tailwindServer.js:2:27803
    at eval (eval at create (/Users/jeffbeltran/.vscode/extensions/bradlc.vscode-tailwindcss-0.6.14/dist/server/tailwindServer.js:50:32334), <anonymous>:27:1)
    at /Users/jeffbeltran/.vscode/extensions/bradlc.vscode-tailwindcss-0.6.14/dist/server/tailwindServer.js:2:13662
    at /Users/jeffbeltran/.vscode/extensions/bradlc.vscode-tailwindcss-0.6.14/dist/server/tailwindServer.js:2:27803
    at eval (eval at create (/Users/jeffbeltran/.vscode/extensions/bradlc.vscode-tailwindcss-0.6.14/dist/server/tailwindServer.js:50:32334), <anonymous>:15:1)
    at /Users/jeffbeltran/.vscode/extensions/bradlc.vscode-tailwindcss-0.6.14/dist/server/tailwindServer.js:2:27803

this could 100% be on me with how i published the module, but at this point this extension is the only thing not working.

if it helps, i can fix the issue with the above error by directly referencing the module via

 presets: [require("./node_modules/@homevalet/bowtie/dist/config")],

so not a blocking issue but would be nice to see if it's something i could do on my end.

Cheers and thanks for this great extension

@bradlc
Copy link
Contributor

bradlc commented Sep 24, 2021

Hey @JeffBeltran. Is @homevalet/bowtie/config the correct path? You use @homevalet/bowtie/dist/config in your last example so I'm wondering if it's meant to be require("@homevalet/bowtie/dist/config")? Or does the config directory have a package.json file with a main field?

@JeffBeltran
Copy link
Author

hey thanks @bradlc, @homevalet/bowtie/config is the correct path, sorry about the confusion, it was likely part of my debugging that made it's way to that comment. As for the package.json, this is the entry i have

"main": "./dist/bowtie.umd.js",
"module": "./dist/bowtie.es.js",
"exports": {
    ".": {
        "import": "./dist/bowtie.es.js",
        "require": "./dist/bowtie.umd.js"
    },
    "./config": "./dist/config/index.js"
},

and just to be more clear

// this works for both this extension and tailwind config
presets: [require("./node_modules/@homevalet/bowtie/dist/config")]

// this only works for the tailwind config, the extension gives the above error
presets: [require("@homevalet/bowtie/config")],

// this doesn't work for any of them
presets: [require("@homevalet/bowtie/dist/config")]

if it would help i'll throw together a public example

@bradlc bradlc added the bug Something isn't working label Sep 24, 2021
@dimitrisnl
Copy link

Thank you @JeffBeltran - I have the same issue, and your ./node_modules/@.. workaround saved the day for me. Hoping for a proper fix.

@bradlc
Copy link
Contributor

bradlc commented Sep 29, 2021

Thanks for the details @JeffBeltran! This should be fixed in v0.6.15 – the extension now takes exports fields in to account 👍

@bradlc bradlc closed this as completed Sep 29, 2021
@JeffBeltran
Copy link
Author

Cheers @bradlc just tested this out and can confirm this is now resolved resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants