Repox
Repox

Reputation: 15476

Webpack - dependency not found

I just started using Laravel Mix which is using webpack. I'm having some issues resolving dependencies.

I tried to install l20n with npm install l20n, added it to my project by adding require('l20n'); and then I ran npm run dev only to be told the following:

ERROR  Failed to compile with 1 errors                                                

This dependency was not found:

* fs in ./~/l20n/dist/bundle/node/l20n.js

Alright, so I figured I had to install fs too, issuing npm install fs and then I ran npm run dev again, but I get the exact same message. What am I doing wrong?

Upvotes: 2

Views: 3075

Answers (1)

Dimitris Karagiannis
Dimitris Karagiannis

Reputation: 9358

Ok, I checked out the source and I think I know what the issue is. The lib you are using is supposed to run in a node environment.

So, in your webpack configuration add this:

  target: 'node'

For more info on targets see this

Upvotes: 1

Related Questions