我已经能够让 webpack 在bower_components
. .bower.json
当凉亭组件仅包含文件而不包含文件时,我遇到了问题bower.json
(请注意,第一个文件名前面有 a .
)。
我的文件的简化版本webpack.config.js
如下所示:
var ResolverPlugin = require('webpack/lib/ResolverPlugin');
// webpack configuration
module.exports = {
entry: {
app: 'app.js'
},
output: {
filename: '[name].js'
},
resolve: {
modulesDirectories: ['node_modules', 'web_modules', 'bower_components', 'static']
},
plugins: [
new ResolverPlugin(
new ResolverPlugin.DirectoryDescriptionFilePlugin('bower.json', ['main'])
)
]
};
我正在尝试使用jquery.selectBoxIt作为凉亭组件。另一个问题可能是它的文件中缺少一个main
字段.bower.json
。对于它的价值,我在下面包含了该文件:
// .bower.json
{
"name": "jquery.selectBoxIt",
"homepage": "https://github.com/gfranko/jquery.selectBoxIt.js",
"version": "3.8.1",
"_release": "3.8.1",
"_resolution": {
"type": "version",
"tag": "v3.8.1",
"commit": "ffa615b25ebf4fac392726b17c857d429acf244c"
},
"_source": "git://github.com/gfranko/jquery.selectBoxIt.js.git",
"_target": "~3.8.1",
"_originalSource": "jquery.selectBoxIt",
"_direct": true
}