我正在尝试将webpack 3与bower组件集成。但是,我似乎无法为主文件读取bower.json
。
这是我的配置:
{
context: __dirname,
devtool: 'inline-sourcemap',
entry: entries,
output: {
path: path.join(__dirname, 'build/js/modules/'),
filename: '[name].bundle.js',
},
module: {
rules: [
{
test: /\.coffee$/,
use: [
{ loader: 'coffee-loader' },
]
},
{
test: /\.js|\.jsx$/,
exclude: /(node_modules|bower_components)/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
[
'env',
{
targets: {
node: '6.11.4',
browsers: [
'last 2 versions',
'> 5%',
'ie >= 11',
'not and_chr > 0',
'not and_uc > 0',
'not android > 0',
'not ie_mob > 0',
'not ios_saf > 0',
'not op_mini > 0',
]
},
},
],
'es2015',
'react',
],
plugins: []
}
},
]
},
{
test: /\.jade$/,
exclude: [/node_modules|bower_components/],
use: [
{ loader: 'jade-loader' },
]
}
]
},
resolve: {
extensions: ['.js', '.jsx', '.coffee'],
alias: {
'spinner': path.resolve(__dirname, '../common/public/scripts/jquery-ui-1.9.1.custom.min.js'),
},
descriptionFiles: ['package.json', 'bower.json'],
modules: ['node_modules', 'bower_components'],
mainFields: ['module', 'main'],
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'common',
minChunks: 3,
}),
],
}
我不知道我做错了什么。
我正在使用webpack: 3.6.0
凉亭组件在build/bower_components/