javascripttailwind-csses6-modulescommonjs

Tailwind 3.3.2 - module is not defined


I am stuck on a tutorial which is incorporating Tailwind, which in this case is tailwind 3.3.2.

Per the tutorial, I am supposed to open a file called tailwind.config.js and paste the below code from https://tailwindcss.com/docs/installation:

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ["./src/**/*.{html,js}"],
  theme: {
    extend: {},
  },
  plugins: [],
}

I immediately get the red squiggly line under "module", with an error that reads as follows:

enter image description here

What did I do wrong? The tutorial did not encounter this error.


Solution

  • Seems like the code itself is correct. The message you are seeing in your IDE seems to be coming from ESLint, with regards to the no-undef rule. To resolve the error, consider letting ESLint know that this file is meant to be used in the environment of Node.js by adding /*eslint-env node*/ as per the the documentation.