Skip to content

Doesn't work with ES Module syntax #909

@AnzeKop

Description

@AnzeKop

What version of VS Code are you using?
Latest

What version of Tailwind CSS IntelliSense are you using?
Latest 0.10.5

What version of Tailwind CSS are you using?
3.3.2

What package manager are you using?
Npm

What operating system are you using?
Linux, macOS

Tailwind config
import { fileURLToPath } from 'url';
const componentsDir = fileURLToPath(new URL('./components', import.meta.url));

export default {
content: [${componentsDir}/**/*.{js,ts,jsx,tsx}],
important: true,
theme: {
extend: {},
},
plugins: [],
};

Describe your issue

[Error - 10:50:21 AM] Tailwind CSS: Cannot use 'import.meta' outside a module
{directory}/tailwind.config.js:2
const componentsDir = _url.fileURLToPath.call(void 0, new URL('./components', import.meta.url));
^^^^

SyntaxError: Cannot use 'import.meta' outside a module

Telling me that it doesn't support ES6 syntax. Converting the config to commonJS fixes this bug but the build pipeline forces me to use ES6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions