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

tailwind css intellisense doesn't works with esm tailwindcss #736

Closed
mofflindon opened this issue Mar 15, 2023 · 2 comments
Closed

tailwind css intellisense doesn't works with esm tailwindcss #736

mofflindon opened this issue Mar 15, 2023 · 2 comments

Comments

@mofflindon
Copy link

mofflindon commented Mar 15, 2023

What version of Tailwind CSS IntelliSense are you using?
v0.9.8

What version of Tailwind CSS are you using?

"tailwindcss": "^3.2.7"

What package manager are you using?

npm

What operating system are you using?

Windows

Tailwind config

const tailwindConfig = {
  content: ["./src/**/*.{js,jsx,ts,tsx}"],
  theme: {
    extend: {},
  },
  variants: {
    extend: {},
  },
  plugins: [],
};

export default tailwindConfig;

Reproduction URL
https://github.com/mofflindon/esm-tailwindcss-issue

VS Code settings

{
  "files.autoSave": "onFocusChange",
  "editor.guides.bracketPairs": true,
  "cssrem.vw": true,
  "cssrem.wxss": true,
  "cssrem.hover": "always",
  "cssrem.addMark": true,
  "colorize.colorized_variables": ["CSS"],
  "security.workspace.trust.untrustedFiles": "open",
  "editor.cursorBlinking": "expand",
  "[dart]": {
    "editor.formatOnSave": true,
    "editor.formatOnType": true,
    "editor.rulers": [80],
    "editor.selectionHighlight": false,
    "editor.suggest.snippetsPreventQuickSuggestions": false,
    "editor.suggestSelection": "first",
    "editor.tabCompletion": "onlySnippets",
    "editor.wordBasedSuggestions": false
  },
  "explorer.confirmDragAndDrop": false,
  "workbench.colorTheme": "CodeSandbox Black 2021",
  "editor.codeLensFontSize": 90,
  "css.enabledLanguages": ["html"],
  "emmet.includeLanguages": {
    "javascript": "javascriptreact",
    "tailwindCSS": "javascriptreact"
  },
  "tailwindCSS.includeLanguages": {
    "plaintext": "javascript",
    "html": "html"
  },
  "files.associations": {
    "javascript": "tailwindcss"
  },
  "editor.quickSuggestions": {
    "comments": "on",
    "strings": "on"
  },
  "editor.tabSize": 2,
  "tailwindCSS.emmetCompletions": true,
  "editor.minimap.enabled": false,
  "javascript.updateImportsOnFileMove.enabled": "always",
  "reactSnippets.settings.prettierEnabled": true,
  "tabnine.experimentalAutoImports": true,
  "material-icon-theme.activeIconPack": "react_redux",
  "editor.fontSize": 17,
  "workbench.editor.highlightModifiedTabs": true,
  "workbench.editor.scrollToSwitchTabs": true,
  "terminal.integrated.tabs.defaultColor": "terminal.ansiBlack",
  "window.customMenuBarAltFocus": false,
  "window.openFilesInNewWindow": "on",
  "editor.defaultFormatter": "esbenp.prettier-vscode",
  "editor.formatOnSave": true,
  "git.enableSmartCommit": true,
  "regex-previewer.enableCodeLens": false,
  "typescript.updateImportsOnFileMove.enabled": "always",
  "gitlens.defaultGravatarsStyle": "identicon",
  "gitlens.fileAnnotations.command": "changes",
  "editor.fontFamily": "Fira Code Medium",
  "editor.codeLensFontFamily": "Fira Code",
  "editor.inlayHints.fontFamily": "Fira Code",
  "editor.fontLigatures": true,
  "markdown.preview.fontFamily": "Fira Code",
  "notebook.outputFontFamily": "Fira Code",
  "terminal.integrated.fontFamily": "Fira Code",
  "errorLens.fontFamily": "Fira Code",
  "workbench.editor.untitled.hint": "hidden",
  "extensions.ignoreRecommendations": true,
  "explorer.confirmDelete": false,
  "git.autofetch": true,
  "workbench.iconTheme": "material-icon-theme",
  "tabnine.receiveBetaChannelUpdates": true,
  "git.openRepositoryInParentFolders": "never",
  "tailwindCSS.classAttributes": ["class", "className"],
  "tailwindCSS.experimental.configFile": null
}

Describe your issue
The problem is that i am using ecmascript modules(i dont wanna change on commonjs) in my tailwindcss.config and postcss.config. It works with Vite but tailwind css intellisense throw error Unexpected token 'export'(how it was for me with webpack where esm tailwindcss dont even works with webpack). Question: how to fix tailwind css intellisense for working with es modules?

Tailwind CSS IntelliSense output:

[Error - 4:59:59 PM] Tailwind CSS: Unexpected token 'export'
c:\Projects\project\project\client\tailwind.config.js:12
export default tailwindConfig;
^^^^^^

SyntaxError: Unexpected token 'export'
    at Object.compileFunction (node:vm:352:18)
    at wrapSafe (node:internal/modules/cjs/loader:1086:15)
    at Module._compile (node:internal/modules/cjs/loader:1121:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1220:10)
    at Module.load (node:internal/modules/cjs/loader:1035:32)
    at Module._load (node:internal/modules/cjs/loader:876:12)
    at c._load (node:electron/js2c/asar_bundle:5:13343)
    at Module.require (node:internal/modules/cjs/loader:1059:19)
    at LI._require.Js.default.require (c:\Users\yoffens\.vscode\extensions\bradlc.vscode-tailwindcss-0.9.8\dist\tailwindServer.js:178:45213)
    at require (node:internal/modules/cjs/helpers:102:18)
@adamwathan
Copy link
Member

Hey! Up until today Tailwind itself didn't support ESM config files, which is why it's not supported in IntelliSense yet. Good news is this will be supported in IntelliSense very soon when we release Tailwind CSS v3.3 in a couple of weeks 👍

Going to close this as we try to reserve issues for bug reports and this is more of a feature request, but look for an update with ESM support soon.

@mofflindon
Copy link
Author

thx!

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

No branches or pull requests

2 participants