簡體   English   中英

webpack如何要求系繩?

[英]How to require tether with webpack?

我有一個用於laravel elixir的webpack應用程序。 在此應用程序中,我有一個bootstrap.js文件,用於初始化我的所有庫。 這里是:

window._ = require('lodash');

/**
 * We'll load jQuery and the Bootstrap jQuery plugin which provides support
 * for JavaScript based Bootstrap features such as modals and tabs. This
 * code may be modified to fit the specific needs of your application.
 */

window.$ = window.jQuery = require('jquery');// $ui = require("jquery-ui");
/**
 * import twitter bootstrap js library
 */
require('bootstrap-sass');
/**
 * import jquery ui
 */
require('jquery-ui-bundle');

/**
 * import jquery datatables
 */
require('datatables.net');

/**
 * import select2
 */
require('select2'); // globally assign select2 fn to $ element

/**
 * import d3
 */
require('d3');

/**
 dropdowns
 */
require('tether');
require('tether-drop');

唯一的問題是,當我構建它時,出現Error: Can't resolve 'tether-drop' 我怎樣才能解決這個問題?

謝謝!

要使用系繩,您需要使其在窗口上可用。

global.Tether = require('tether');

現在,您可以將其與其他庫一起使用,例如,與bootstrap @ 4一起使用。 不要使用導入。

require('bootstrap');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM