2

我刚开始使用使用webpack 的Laravel Mix。我在解决依赖关系时遇到了一些问题。

我尝试使用 安装l20nnpm install l20n通过添加将其添加到我的项目中require('l20n');,然后我运行npm run dev只是被告知以下内容:

ERROR  Failed to compile with 1 errors                                                

This dependency was not found:

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

好吧,所以我想我也必须安装 fs,发出npm install fs然后我npm run dev再次运行,但我得到了完全相同的消息。我究竟做错了什么?

4

1 回答 1

1

好的,我检查了源代码,我想我知道问题出在哪里。您使用的库应该在节点环境中运行。

所以,在你的 webpack 配置中添加这个:

  target: 'node'

有关目标的更多信息,请参阅

于 2017-03-22T20:32:03.803 回答