我的源browserify
coffeeify
文件:使用jQuery UI的使用browserify
$ = jQuery = require 'jquery'
require 'jq-ui'
$ ->
jqueryUiIsLoaded = jQuery.ui
console.log "jquery-ui is loaded: #{jqueryUiIsLoaded}"
我轉換爲main.js
用命令:
browserify source.coffee -t coffeeify > main.js --debug
我的package.json:
{
"name": "jquery_ui_test",
"version": "0.0.1",
"private": true,
"scripts": {
"main": "browserify source.coffee -t coffeeify > main.js --debug"
},
"browser": {
"jquery": "./node_modules/jquery/dist/jquery.min.js",
"jq-ui": "./node_modules/jquery-ui/jquery-ui.js"
},
"browserify-shim": {
"jquery": "$",
"jq-ui": {
"exports": "jq-ui",
"depends": [
"jquery:jQuery"
]
}
},
"dependencies": {
"coffee-script": "*"
},
"devDependencies": {
"browserify": "^6.0.2",
"coffeeify": "^0.7.0",
"jquery": "^2.1.1",
"jquery-ui": "^1.10.5"
}
}
我html:
<html>
<head>
<script src='./main.js'/>
</head>
</html>
在瀏覽器控制檯我看到jQuery UI的未加載:
jquery-ui is loaded: undefined source.coffee:5
我應該怎麼做才能讓jquery-ui
負載browserify
?
你有沒有在沒有使用鮑爾的情況下得到這個工作? – 2015-11-17 04:13:38