Tailwind rebuilding is taking too long on first run - npm

I am using tailwind CLI for my project. when I run npx tailwindcss -i assets/css/input.css -o assets/css/tailwind.css --watch for the first time of the day it takes almost 15 minutes to compile and after that, it rebuilds normally.
I am working on one other project too but have no problem with tailwind there. I also tried re-installing node modules and tailwind but still did not work.

Related

Using the schematics commands in Spartacus

I am trying to use the schematics command "npx ng #spartacus/schematics:add-pwa" (I am not using a global npm repo or angular installation, due to version conflicts with other projects).
I get the following output:
The specified command ("#spartacus/schematics:add-pwa") is invalid. For a list of available options,
run "ng help".
Did you mean "analytics"?
ng cli commands work fine, also adding #spartacus/schematics worked fine (npx ng add #spartacus/schematics#latest), yarn build works fine (npx yarn build).
If I run npx ng add #spartacus/schematics --ssr, this also works fine, prompts me again for the features I want and adds SSR to the project.
Do I have to do anything else to be able to run the additional Spartacus Schematics commands as they are mentioned in the documentation (https://sap.github.io/spartacus-docs/schematics/#additional-commands-for-core-libraries-and-features)?
Thank you!
Cristi C.
Did you try to run npx ng add #spartacus/schematics --pwa?
I found the answer to my question. It was a mistake on my side. I was trying to call:
npx ng #spartacus/schematics:add-pwa
but the correct call is:
npx ng g #spartacus/schematics:add-pwa
Reading the documentation with more attention helps...

vue app not working after npm run build for production

So I created a simple app with vue and works as I expected. But since I ran npm run build and I tried to run that project from /dist directory(for produnction) I just stops. What am i missing here guys?

React-native Fast Refresh broken

recently my Fast Refresh stopped working across ALL of my react native projects, I have even tried init-ing a new project and it is not working there too
I have tried all the attempts below:
-. watchman watch-del-all
-. rm -rf /usr/local/var/run/watchman && brew uninstall watchman && brew install watchman
-. clean node_modules and "npm run -- --reset-cache"
Whatever way I try to reload the app after modifying the source code, the change will not get reflected. I have to stop and uninstall the app, run npm run -- --reset-cache and then run npm run android again in order to have the changes reflected.
This is really killing me as I can not find the cause of it. It was working before and I did not install any app on my machine. I am now short of formatting my machine and start everything from scratch again but this is a Mac and it is troublesome to reformat..
It's not related to react-native, metro bundler, or sudo permission,
It's because of .git/index.lock file!
Just remove it and everything would be OK.
Execute this command in the root directory of your project:
rm .git/index.lock
Have you tried ALL the solutions mentioned here? Seems like there're still a bunch that you haven't tried
https://github.com/facebook/react-native/issues/28420
I tried almost all and still not working, in desperation, the
sudo npx react-native start solved my problem
https://github.com/facebook/react-native/issues/28420#issuecomment-755082770
This doesn't answer the question, but I'm leaving it for people who come here with a slightly different issue.
If after making a code edit, the app shows a message saying 'Refreshing...' but it fully reloads the app, then that means Fast Refresh and Hot Reloading is technically working. But for whatever reason, Fast Refresh is falling back to a full reload. To fix this, see this thread. Basically, name your default exports.

Webpack uninstall not working properly

I decided to remove webpack from one of my react projects as dependencies slow down performance and I wasn't really using it. I tried npm uninstall -g webpack, npm uninstall webpack, npm uninstall webpack webpack-cli, npm remove webpack, etc. I ran npm start after each of these commands to start working on my app again and every time I got the same exact answer: "Error: cannot find module 'webpack'". It seems to be based in the internal loader for the react-scripts but I don't know how to edit that. Thank you in advance for any help you can provide. Note: I did check my dependencies and webpack is not there in either the main or developer dependencies
Since you said something about react-scripts, i'll assume you are using CRA.
The whole build process is inside the react-scripts package, which means that you would need to NOT use react-scrips on you start and build scripts. If you get rid of react-scripts you might be able to get away with webpack.

Run a script each time I add a new npm dependency to my project

I'm using webpack to build a react application. I just applied some optimization to reduce build times in development mode, following this article: http://engineering.invisionapp.com/post/optimizing-webpack/.
It works great but the downside is that I now must remember to rebuild the vendors file each time I add a new dependency.
Is there any way to configure npm through the package.json to automatically run a script whenever a new dependency is added ?
Clarifications about the desired behavior:
I'd like npm to run a script each time I do:
npm install --save a-new-dependency