tailwindlabs / tailwindcss-intellisense

Intelligent Tailwind CSS tooling for Visual Studio Code
2.74k stars 183 forks source link

[pre-release] Unable to use `tailwind.config.ts` config in a v3 project #919

Closed insilications closed 4 months ago

insilications commented 4 months ago

I'm using Tailwind CSS IntelliSense Pre-Release 0.11.46 (2024-03-07, 08:13:46) and it seems the recent update broke using a typescript config (tailwind.config.ts). Converting to .cjs or reverting to the Release version of Tailwind CSS IntelliSense removes the error:

Setting up server…
Listening for messages…
Searching for Tailwind CSS projects in the workspace's folders.
{"tailwind":{"version":"3.4.1","features":["layer:base","separator:root","content-list","jit","css-at-config","relative-content-paths","transpiled-configs"],"isDefaultVersion":false}}
{"tailwind":{"version":"3.4.1","features":["layer:base","separator:root","content-list","jit","css-at-config","relative-content-paths","transpiled-configs"],"isDefaultVersion":false}}
[Error - 8:13:53 AM] [GLOBAL] Error creating project: SyntaxError: Cannot use import statement outside a module
[Global] Creating projects: []

What version of VS Code are you using?

VSCode: 1.88 Tailwind CSS: v3.4.1

Tailwind config

import { skeleton } from '@skeletonlabs/tw-plugin';
import forms from '@tailwindcss/forms';
import typography from '@tailwindcss/typography';
import { join } from 'path';
import { myCustomTheme } from './customTheme';

export default {
    darkMode: 'selector',
    content: ['./src/**/*.{html,js,svelte,ts}', join(require.resolve('@skeletonlabs/skeleton'), '../**/*.{html,js,svelte,ts}')],
    theme: {
        extend: {},
    },
    plugins: [
        forms,
        typography,
        skeleton({
            themes: {
                custom: [myCustomTheme],
                // preset: [{ name: 'crimson', enhancements: true }],
            },
        }),
    ],
};
thecrypticace commented 4 months ago

Thanks for reporting this — project "discovery" got a big rework so was bound to run into a few issues though I thought I'd handled this one.

I'll take a look today — thanks!

insilications commented 4 months ago

If you need more data to fully replicate this let me know.

thecrypticace commented 4 months ago

This is now fixed and I've added tests to make sure we don't regress on this in the future. Be sure to go into VSCode and make sure to update to the latest pre-release version. Thanks for giving this a test!

insilications commented 4 months ago

Working perfectly now. Thanks.