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

typescript-require breaks VSCode extension #577

Closed
AndyOGo opened this issue Jul 12, 2022 · 6 comments · Fixed by #583
Closed

typescript-require breaks VSCode extension #577

AndyOGo opened this issue Jul 12, 2022 · 6 comments · Fixed by #583

Comments

@AndyOGo
Copy link

AndyOGo commented Jul 12, 2022

What version of Tailwind CSS IntelliSense are you using?

v0.8.6

What version of Tailwind CSS are you using?

v3.1.2

What package manager are you using?

$ node -v
v16.13.0
$ npm -v
8.1.0

What operating system are you using?

Redhat Linux

Describe your issue

I'm using typescript-require to load configurations in my tailwind.config.js file, like:

// Initialize
require('typescript-require');

const { colors } = require("./colors");

/** @type {import("tailwindcss/tailwind-config").TailwindConfig} */
module.exports = {
  content: ["./src/**/*.{html,ts,tsx}"],
  theme: {
    colors,
  },
};

colors.ts

export const colors = {
  transparent: "transparent",
  current: "currentColor",
  white: "#FFF",
  black: "#000",
@bradlc
Copy link
Contributor

bradlc commented Jul 25, 2022

Hey @AndyOGo. I can't reproduce the issue, are you able to share your project?

@AndyOGo
Copy link
Author

AndyOGo commented Jul 25, 2022

Hey @bradlc.

I clarified the issue with a colleague.

The problem only arises when we omit the .ts extension - also within TS files.

I think enabling preferTsExts of ts-node/register should help with that.

I tried that:

require("ts-node").register({
  preferTsExts: true,
});

const { colors } = require("./colors");

@AndyOGo AndyOGo closed this as completed Jul 25, 2022
@AndyOGo AndyOGo reopened this Jul 25, 2022
@AndyOGo
Copy link
Author

AndyOGo commented Jul 25, 2022

Seems to be a limitation of node itself according to that issue
TypeStrong/ts-node#116

@AndyOGo
Copy link
Author

AndyOGo commented Jul 25, 2022

@bradlc Alright, now I got it working with experimentalResolver

Related issue:
TypeStrong/ts-node#1514

require("ts-node").register({
  preferTsExts: true,
  experimentalResolver: true,
});

const { colors } = require("./colors");

@bradlc
Copy link
Contributor

bradlc commented Jul 25, 2022

Found a fix for this so your original version should work in the next release 👍

@AndyOGo
Copy link
Author

AndyOGo commented Jul 25, 2022

Even better, thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants