我正在使用Browserify尝试从URL导入模块(jquery),但它不起作用:
import $ from 'http://code.jquery.com/jquery-2.1.4.min.js'
抛出错误:
> browserify wwwroot/js/index.js -t babelify --outfile wwwroot/js/bundle.js
Error: Cannot find module 'http://code.jquery.com/jquery-2.1.4.min.js' from 'C:\Dev\Sample\Sample.Web\wwwroot\js'
at C:\Dev\Sample\Sample.Web\node_modules\browserify\node_modules\resolve\lib\async.js:46:17
at process (C:\Dev\Sample\Sample.Web\node_modules\browserify\node_modules\resolve\lib\async.js:173:43)
at ondir (C:\Dev\Sample\Sample.Web\node_modules\browserify\node_modules\resolve\lib\async.js:188:17)
at load (C:\Dev\Sample\Sample.Web\node_modules\browserify\node_modules\resolve\lib\async.js:69:43)
at onex (C:\Dev\Sample\Sample.Web\node_modules\browserify\node_modules\resolve\lib\async.js:92:31)
at C:\Dev\Sample\Sample.Web\node_modules\browserify\node_modules\resolve\lib\async.js:22:47
at FSReqWrap.oncomplete (fs.js:95:15)
支持吗?
答案 0 :(得分:2)
支持吗?
不,不是。但是,有一个插件允许从jsDelivr加载库,CDN:https://github.com/dsdenes/browserify-cdnjs