Skip to content

FIX: Webpacker install #30

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

Merged
merged 1 commit into from
Feb 4, 2021
Merged

Conversation

dixpac
Copy link
Contributor

@dixpac dixpac commented Jan 30, 2021

Current webpacker install, was problematic.

Main issue is that current release of webpacker uses Postcss7.
Tailwind 2 expects Postcss8, and that causes a lot of issues.

Tailwind team has published Tailwind 2 compatible Postcss7 package

So in order for the generator to work with Rails 6.1 defaults, this PR
deferes to use tailwindcss@npm:@tailwindcss/postcss7-compat package.

By, using this package users don't loose anything it is Tailwind 2.


There is a way to make it work without using the Postcss7 package by
using latest rails-webpacker beta, but I think it is smarter for now
not to use beta releases.

When rails wepbacker publishes latest with Postcss8 then we can change
the generator.

Shout out to @BakiVernes for helping on this PR.

Fixes #18

Current webpacker install, was problematic.

Main issue is that current release of webpacker uses Postcss7.
Tailwind 2 expects Postcss8, and that causes a lot of issues.

Tailwind team has published Tailwind 2 compatible Postcss7 [package](https://tailwindcss.com/docs/installation#post-css-7-compatibility-build)

So in order for the generator to work with Rails 6.1 defaults, this PR
deferes to use `tailwindcss@npm:@tailwindcss/postcss7-compat` package.

By, using this package users don't loose anything it is Tailwind 2.

--------------

There is a way to make it work without using the `Postcss7` package by
using latest `rails-webpacker` beta, but I think it is smarter for now
not to use beta releases.

When rails wepbacker publishes latest with `Postcss8` then we can change
the generator.
@dixpac dixpac force-pushed the dix/fix_webpacker_install branch from 20295b9 to 28cec67 Compare January 30, 2021 14:43
@dhh dhh merged commit 076857e into rails:main Feb 4, 2021
@miharekar
Copy link

There is a way to make it work without using the Postcss7 package by
using latest rails-webpacker beta, but I think it is smarter for now
not to use beta releases.

Did you mean postcss8 here?

Is there a upgrade guide of some kind to do it this other way? I followed the README in rails-webpacker, but couldn't get it to work 😅

ERROR in ./app/packs/entrypoints/application.scss 1:0
Module parse failed: Unexpected character '@' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> @import "tailwindcss/base";

And I've added all css-loader mini-css-extract-plugin css-minimizer-webpack-plugin postcss postcss-import postcss-loader to yarn packages and moved application.css inside entrypoints.

Anyway, @dixpac, if you know of any upgrade guide for dummies, I'd like that very much 😅

@dixpac
Copy link
Contributor Author

dixpac commented Feb 8, 2021

@miharekar sorry for the late reply 😄

Here is a demo repo with PostCSS 8 that works for me.
Don't ask me how it works, only God knows. I tried everything until I get it working 🤣
Hope it helps!

@miharekar
Copy link

@dixpac 🙈😂

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

Successfully merging this pull request may close these issues.

Webpack dev server doesn't work anymore
3 participants