アプリケーション上で一つにまとたjsファイルを扱うのと、チームで同じバージョンを共有したいのでpackage.jsonにバージョンを記載して管理しています。
またbrowserifyはnpm runコマンドにて走る様に設定。
今回のjquery-uiをrequireしている理由としてはdatepickerを使用する為ですが、
表題にもある様にwidgetしかexportされない為にdatepicker使用するスクリプトでエラーが起きてしまいます。
以下package.jsonとbuildされたjsファイルのコメント欄になります。
{ "name": "hoge", "version": "1.0.0", "description": "", "main": "bundle.js", "dependencies": {}, "devDependencies": { "bootstrap": "^4.0.0-alpha.2", "browserify": "^13.0.0", "clean-css": "^3.4.9", "fancybox": "^3.0.0", "imagesloaded": "^4.1.0", "jquery": "^2.2.3", "jquery-ui": "^1.12.1", "node-sass": "^3.4.2", "nodemon": "^1.8.1", "slick-carousel": "^1.5.9", "sticky-kit": "^1.1.3", "uglify-js": "^2.6.1", "watchify": "^3.7.0" }, "scripts": { "build-css": "node-sass --include-path scss webroot/sass/app.scss webroot/css/app.css", "watch-css": "nodemon -e scss -x \"npm run build-css\"", "build-js": "browserify webroot/js/main.js -o webroot/js/bundle.js", "watch-js": "watchify webroot/js/main.js -o webroot/js//bundle.js -dv", "uglifyjs": "uglifyjs webroot/js/app.js > webroot/js/app.min.js", "watch": "npm run watch-css & npm run watch-js" }, "author": "hogehoge", "license": "ISC" }
// -------------------------- <!-- ここまで省略 --> -------------------------- // return ImagesLoaded; }); },{"ev-emitter":1}],4:[function(require,module,exports){ /*! * jQuery UI Widget 1.12.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors * Released under the MIT license. * http://jquery.org/license */ //>>label: Widget //>>group: Core //>>description: Provides a factory for creating stateful widgets with a common API. //>>docs: http://api.jqueryui.com/jQuery.widget/ //>>demos: http://jqueryui.com/widget/ ( function( factory ) { if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. define( [ "jquery", "./version" ], factory ); } else { // Browser globals factory( jQuery ); } }( function( $ ) { var widgetUuid = 0; var widgetSlice = Array.prototype.slice; <!-- 以下省略 -->
どなたかご教示いただけますと幸いです。
あなたの回答
tips
プレビュー