I am wondering why is taking so long for webpack to run?
The last build it was: 141808ms … that’s almost 142 seconds o.O , insane, right?
My app is a very simple react app (just learning it ), just 1 main component with 2 simple components within it.
I have all the code on github.
By webkit you mean webpack?
Silly me xD… I’ve modified! Thanks!
Not working… still taking a lot of time… 44 seconds…
How are you running it?
In my terminal I’m running: webpack
command. Same as you do!
Try this, in your package.json
:
{
"name": "react-tutorials",
"version": "0.0.1",
"description": "Learning react",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"webpack": "webpack" <--- add this line
},
...
And in your terminal run npm run webpack
Interesting… it is now taking 5 seconds… Why was that huge before?
EDIT: now with webpack
commad is also taking < 5 seconds…
I guess you have installed webpack globally. And who knows what it was compiling. Maybe all the .js and .jsx files on your computer.
Rule of thumb: don’t install anything globally.
Hmm… Yes I did. Why wouldn’t I install things globally?
Also, it if is that wrong, how can I remove them?
To remove I think npm uninstall webpack -g
should work.
I removed it from -g, and I am using npm run webpack and now it takes again around 40 seconds … It’s annoying when you want to fix some errors and you have to compile everytime…
Any advice on how could I go around this?
Hard to say. Problem is not in your code. If you are on Windows I can only recommend to restart your pc (I know sounds silly )
Also check your Node and npm versions.
node -v
npm -v
node : 4.5.0
npm: 2.15.9
I am running on a mac. I checked the Activity Monitor and everything looks fine.
Looks very old.
Latest node: 7.2.1
Latest npm: 4.0.3
Is there a command to upgrade them?
I usually use:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
I’m on linux, but this should work same on mac.
Thank you.
I have now node: 7.2.1 but npm only 3.10.10