我有这个index.jade文件
include scripts
script( src='path of my site/project name/src/scripts/index.js' )
还有index.js文件
var _ = require('./underscore');
var IScroll = require('iscroll/build/iscroll-probe.js');
var zepto = require('./vendor/zepto.js');
var morpheus = require('morpheus');
var easings = require('./vendor/morpheus-easings.js');
require('./vendor/zepto.touch.js');
我收到ReferenceError:require未定义
我想包括正确工作的模块有什么帮助吗?
最佳答案
第一:
npm install iscroll --save
然后这样:
global.IScroll = require('iscroll');
关于javascript - 如何在我的js文件中需要一些npm模块,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/23013491/