3
js文件在我的HTML文件,我包括像腳本:不能包括在電子
<script src="js/index.js"></script>
在我的劇本,我儘量只寫const Configuration = require("./configuration");
添加configuration.js
文件。 configuration.js
與index.js
位於同一個文件夾中。但在控制檯上它說:
Uncaught Error: Cannot find module './configuration'
configuration.js和index.js文件都在/app/js/
文件夾中。
什麼是解決方案?我可以包含像Lodash這樣的Node.js模塊。
change require(「./ js/configuration」);也許完成了。 – AhbapAldirmaz
@AhbapAldirmaz它的工作,實際上。我不明白爲什麼。如果您可以添加答案,我會將其標記爲正確。 **編輯**:哦,我猜路徑是相對於html文件的。解決了它。 – nope