Closed mdrahiem closed 3 years ago
Hey! Thank you for your issue report! Much appreciated! 🙏
Do you mean that you get a size of 3.71 MiB
or really 37.1 MiB
?
Because when I test it with your tailwind.config.js
file, I get a 3.67MB
which makes sense because I am using tailwindcss
the cli directly so there is currently no sourcemapping going on.
Can you verify that it is 3.71 MB
or 37.1 MB
?
Because if it is 3.71 MB
, that 's expected.
First of all thanks much for your reply.
Yes. Unfortunately its 37.1 MiB. Please check the screenshot below.
If it is 3.71 MB
then I shouldn't have any problem but as it is 37.1 MiB
whenever I do some change in my code, hot reloading takes atleast 3-4 seconds of time and then the browser gets refreshed :(
Can you create a (minimum) repo that reproduces this behaviour? That way I can look into it.
The files you mentioned above are sometimes incomplete, and not all the required files are there.
I've created a simple repo (basic structure). https://github.com/mdrahiem/simple-react-redux-tailwind-app
After this basic set-up I see main.js
file size is 22.5 MiB
.
One more small thing. When I've changed devtool: 'inline-source-map',
--> devtool: 'source-map',
in webpack.dev.js
file I see main.js
file size got decreased to 8.25 MiB
which is also very high. Could you please suggest me if the setup is correct? or please let me know If I need to do any modifications.
Hey! You are using ./assets/main.css
inside your src/index.js
https://github.com/mdrahiem/simple-react-redux-tailwind-app/blob/master/src/index.js#L4. I am not sure why you even have that file, but that looks like a super big final generated file which is incorrect and strange.
Anyway, if you delete that file and in your src/index.js
you replace import './assets/tailwind.css'
with import './assets/tailwind.css'
(the file with the 3 directives in it) OR with import "tailwindcss/tailwind.css"
(this way you can also delete the ./assets/tailwind.css
file, you will get the expected result.
This in combination with the devtool
for sourcemaps fix, results in a 1.65 MiB
main.js file on my machine which is an expected file size for development.
@RobinMalfait First of all thanks much for your time. But the problem is not fixed. If I replace ./assets/main.css
with './assets/tailwind.css'
then the styles are no applied to the page (styles are broken). Otherwise when I try to use import "tailwindcss/tailwind.css"
its throwing an error.
You have to add the postcss-loader
for webpack, currently you are not using postcss
.
If you want to use @import "tailwindcss/tailwind.css"
then you probably also want a nesting plugin https://tailwindcss.com/docs/using-with-preprocessors
Alternatively, to the nested plugin, you can use this:
/* ./src/assets/tailwind.css */
@import 'tailwindcss/base';
@import 'tailwindcss/components';
@import 'tailwindcss/utilities';
Hello there,
I've setup a react project from scratch and installed tailwind css in it. I am unable to figure out why the file size is gone too high after this. Below are my configurations.
package.json
tailwind.css
tailwind.config.js
webpack.common.js
webpack.dev.js