tailwindcss: Dependencies broken : SyntaxError: The requested module '@nuxt/kit' does not provide an export named 'addDevServerHandler'

Version

@nuxtjs/tailwindcss: 5.0.4 nuxt: 2.15.8

Steps to reproduce

Moving from 5.0.3 to 5.0.4 give me the following error : SyntaxError: The requested module '@nuxt/kit' does not provide an export named 'addDevServerHandler'

It seems due to the @nuxt/kit dependencie update, in 5.04, from npm:@nuxt/kit-edge@latest to ^3.0.0-rc.2

The strangest thing is that error come from the node_modules/@nuxtjs/tailwindcss/dist/module.mjs file, which indeed import addDevServerHandler from @nuxt/kit and … declare these consts on top of the file :

const name = "@nuxtjs/tailwindcss";
const version = "5.1.2";

It’s like if the dist/module.mjs which was packaged was the wrong one ; maybe you should just re-package the 5.0.4 ?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (1 by maintainers)

Most upvoted comments

adding an empty array named devServerHandlers to nuxt.config file will solve the issue.

devServerHandlers: [],

That workaround is indeed working 👍

import tailwindTypography from '@tailwindcss/typography'

export default {
  buildModules: [
    '@nuxtjs/tailwindcss'
  ],
  devServerHandlers: [], // Workaround for https://github.com/nuxt-community/tailwindcss-module/issues/487
  tailwindcss: {
    config: {
      plugins: [tailwindTypography]
    }
  }
}

adding an empty array named devServerHandlers to nuxt.config file will solve the issue.

devServerHandlers: [],

But … in practice, as we can see : 5.0.* is compatible with nuxt2 and nuxt3 5.1.* is not anymore compatible with nuxt2 due to the bump to @nuxt/kit 3.0.0-rc.3

So, as a breaking change, should this be fixed in 5.1 and only released in 6.* ?

5.1.2 is compatible with Nuxt 2, but you have to add devServerHandlers: [] in nuxt.config file.

The strangest thing is that error come from the node_modules/@nuxtjs/tailwindcss/dist/module.mjs file, which indeed import addDevServerHandler from @nuxt/kit and … declare these consts on top of the file :

const name = "@nuxtjs/tailwindcss";
const version = "5.1.2";

Look like @nuxtjs/tailwindcss is resolve to version 5.1.2 instead of 5.0.4, I’ve installed using @nuxtjs/tailwindcss@5.0.4 and it’s work fine.

Version 5.1.2 will break when not using @nuxt/kit@^3.0.0-rc.3 because addDevServerHandler is added in this version.

Try running npm why @nuxt/kit (or yarn) to see if package is resolved to version 3.0.0-rc.3 or not.

The wrong exact version was due to an error from me : I have "@nuxtjs/tailwindcss": "^5.0.4" in my dependencies, so indeed, it’s allowing the patch and minors updates, like 5.1.* versions.

Fixing the dependencie version to "@nuxtjs/tailwindcss": "~5.0.4" avoid that, and it’s working well in 5.0.4

But … in practice, as we can see : 5.0.* is compatible with nuxt2 and nuxt3 5.1.* is not anymore compatible with nuxt2 due to the bump to @nuxt/kit 3.0.0-rc.3

So, as a breaking change, should this be fixed in 5.1 and only released in 6.* ?