![](/img/trans.png)
[英]Include jQuery datatables in webpack.ProvidePlugin on webpack
[英]Can't include jQuery Datatables via webpack bower components
require('datatables'); does not work
我很難嘗試將jQuery-Datatables作為Bower的webpack模塊包含在內,當前設置可與其他Bower組件一起使用,這是webpack配置文件的一部分:
module.exports = {
plugins: [
new webpack.ResolverPlugin(
new webpack.ResolverPlugin.DirectoryDescriptionFilePlugin("bower.json", ["main"])
)
],
resolve: {
modulesDirectories: ['node_modules', 'bower_components']
}
};
問題在於DirectoryDescriptionFilePlugin
期望在main
字段中輸入一個字符串,而datatables的bower.json
聲明一個數組:
"main": [
"media/js/jquery.dataTables.js",
"media/css/jquery.dataTables.css"
]
關於這里為什么會這樣的整個討論。
(無恥的插頭)
我創建了bower-webpack-plugin ,您可能想看看。 它仍在開發中,但應該在main
領域處理數組。 此外,如果您發現任何問題,請隨時報告錯誤,我們將嘗試修復它。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.