finchy70's avatar

Error after upgrading to Tailwindcss 2

I followed the upgrade instructions on tailwindcss docs but after installing PostCSS 7 compatibility build I get this error when I run npm run development -- --watch

 error  in ./resources/css/app.css

Module build failed (from ./node_modules/css-loader/index.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: value.charCodeAt is not a function

My tailwind.config.js is

module.exports = {
  future: {
    removeDeprecatedGapUtilities: true,
    purgeLayersByDefault: true,
  },
  purge: [],
  theme: {},
  variants: {},
  plugins: [
      require('@tailwindcss/ui'),
  ],
}

and my webpack.mix.js

const mix = require('laravel-mix');

mix.js('resources/js/app.js', 'public/js')
    .postCss('resources/css/app.css', 'public/css', [
    require('tailwindcss'),
    require('autoprefixer'),
    ])
    .browserSync({
        browser: 'google chrome',
        proxy: 'inspect.test',
        host: "inspect.test",
        open: 'external',
        port: 3000,
        notify: false,
        watch: true,
    });

Any help would be appreciated. Paul

0 likes
12 replies
rezuankassim's avatar

Hi Paul,

I have managed to find a temporary solution for this. Just comment this @import 'tailwindcss/components'; code in app.css in your resource folder. But please bear in mind if you are using tailwindcss/components then it is best to wait for official fix.

Ps. form-input is now changed too in tailwind, check here https://tailwindui.com/changes-for-v2

Please tell if it works for you.

1 like
finchy70's avatar

This works for me as I'm not using components in this project.

RhysLees's avatar

you can leave components on there, it is 'require('@tailwindcss/ui')' in tailwind.config.js that causes the issue for me.

Do the following for no issues:

npm uninstall tailwindcss postcss autoprefixer
npm install tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
npm install @tailwindcss/forms @tailwindcss/typography @tailwindcss/aspect-ratio

tailwind.config.js

module.exports = {
  // ...
  plugins: [
    // require('@tailwindcss/ui'),
    require('@tailwindcss/forms'),
    require('@tailwindcss/typography'),
    require('@tailwindcss/aspect-ratio'),
  ]
}
npm run dev
2 likes
RhysLees's avatar

I'm having same issue. does anyone know if commenting out the components will break Jetstream?

RhysLees's avatar

ive tried this, it still gets the same error

RhysLees's avatar
RhysLees
Best Answer
Level 3

you can leave components on there, it is 'require('@tailwindcss/ui')' in tailwind.config.js that causes the issue for me.

Do the following for no issues:

npm uninstall tailwindcss postcss autoprefixer
npm install tailwindcss@npm:@tailwindcss/postcss7-compat postcss@^7 autoprefixer@^9
npm install @tailwindcss/forms @tailwindcss/typography @tailwindcss/aspect-ratio

tailwind.config.js

module.exports = {
  // ...
  plugins: [
    // require('@tailwindcss/ui'),
    require('@tailwindcss/forms'),
    require('@tailwindcss/typography'),
    require('@tailwindcss/aspect-ratio'),
  ]
}
npm run dev
5 likes

Please or to participate in this conversation.