Webpack taking too long?

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 :slight_smile: ), 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!

One second for me. Try to delete node_modules folder and run npm i to reinstall.

1 Like

Not working… :disappointed_relieved: 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

1 Like

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.

1 Like

Hmm… Yes I did. :thinking: Why wouldn’t I install things globally?
Also, it if is that wrong, how can I remove them?

2 Likes

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 :expressionless:… 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 :slight_smile: )

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. :expressionless:

Looks very old.

Latest node: 7.2.1
Latest npm: 4.0.3

Is there a command to upgrade them? :slight_smile:

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 :slight_smile: