I just created a new Vue application by runningnpm init vue@latestas specified in the official documentation. I then tried to add Tailwind to my application following the guides on the Vue and Vite websites. However, when opening the filetailwind.config.js, I noticed that ESLint tells me thatmoduleis undefined and themodule.exportssyntax does not work.
why is that? How can I solve it?
Edit: The default.eslintrc.cjsfile created by Vue is as follows:
/* eslint-env node */ require("@rushstack/eslint-patch/modern-module-resolution"); module.exports = { root: true, extends: [ "plugin:vue/vue3-essential", "eslint:recommended", "@vue/eslint-config-prettier", ], parserOptions: { ecmaVersion: "latest", }, };
Consider using
.eslintrc.cjs… overrides: [ { files: ["{vue,vite}.config.*"], env: { node: true, }, }, ],and set the
compilerOptions.types: ["node"]TS option only for these files.It might look like this:
.eslintrc.cjs/* eslint-env node */ require("@rushstack/eslint-patch/modern-module-resolution"); module.exports = { root: true, extends: [ "plugin:vue/vue3-essential", "eslint:recommended", "@vue/eslint-config-typescript", "@vue/eslint-config-prettier", ], overrides: [ { files: ["cypress/e2e/**/*.{cy,spec}.{js,ts,jsx,tsx}"], extends: ["plugin:cypress/recommended"], }, { files: ["{vue,vite}.config.*"], env: { node: true, }, }, ], parserOptions: { ecmaVersion: "latest", }, };tsconfig.config.json{ "extends": "@vue/tsconfig/tsconfig.node.json", "include": ["vue.config.*", "vite.config.*", "vitest.config.*", "cypress.config.*", "playwright.config.*"], "compilerOptions": { "composite": true, "types": ["node"] } }Add it to
.eslintrc.cjsenv: { node: true, },So your file looks like
/* eslint-env node */ require("@rushstack/eslint-patch/modern-module-resolution"); module.exports = { root: true, env: { node: true, }, extends: [ "plugin:vue/vue3-essential", "eslint:recommended", "@vue/eslint-config-prettier", ], parserOptions: { ecmaVersion: "latest", }, };You can add anyof thesevalues