[英]nodeJS using NPM modules in external script files
I am working on a markdown converter application, and using an NPM package showdown. 我正在使用降价转换器应用程序,并使用NPM包对决。 In my app.js file I have a
var showdown = require('showdown');
在我的app.js文件中,我有一个
var showdown = require('showdown');
which is properly being added. 已正确添加。 In my front end I require a script.js which needs to use this.
在我的前端,我需要一个script.js来使用它。 However, it doesn't recognize the showdown variable.
但是,它无法识别showdown变量。 The code works perfectly if I use the showdown cdn above where I include my script.js.
如果我使用上面的showdown CDN(其中包含我的script.js),则代码可以完美工作。 How do I make it so that my NPM modules can be used across a project?
如何使NPM模块可以在整个项目中使用?
Here's your answer. 这是你的答案。 I have forked your git repo and made changes.
我已经分叉了您的git repo并进行了更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.