我正在尝试学习easy-webpack,因此我开始使用最小项目aurelia项目设置。
运行webpack时出现以下错误。
运行: node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js
错误:
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
- configuration has an unknown property 'metadata'. These properties are valid:
object { amd?, bail?, cache?, context?, dependencies?, devServer?, devtool?, entry, externals?, loader?, module?, name?, node?, output?, performance?, plugins?, profile?, recordsInputPath?, recordsOutputPath?, recordsPath?, resolve?, resolveLoader?, stats?, target?, watch?, watchOptions? }
For typos: please correct them.
For loader options: webpack 2 no longer allows custom properties in configuration.
Loaders should be updated to allow passing options via loader options in module.rules.
Until loaders are updated one can use the LoaderOptionsPlugin to pass these options to the loader:
plugins: [
new webpack.LoaderOptionsPlugin({
// test: /\.xxx$/, // may apply this only for some modules
options: {
metadata: ...
}
})
]
我在webpack文件中没有看到任何对元数据的引用,也不知道导致错误的原因。
这些是我的配置文件
的package.json:
{
"name": "AureliaSpa",
"version": "0.0.0",
"dependencies": {
"aurelia-bootstrapper-webpack": "^1.1.0",
"aurelia-event-aggregator": "^1.0.1",
"aurelia-fetch-client": "^1.1.1",
"aurelia-framework": "^1.1.0",
"aurelia-history-browser": "^1.0.0",
"aurelia-loader-webpack": "^2.1.0",
"aurelia-logging-console": "^1.0.0",
"aurelia-pal-browser": "^1.1.0",
"aurelia-polyfills": "^1.2.0",
"aurelia-route-recognizer": "^1.1.0",
"aurelia-router": "^1.2.1",
"aurelia-templating-binding": "^1.3.0",
"aurelia-templating-resources": "^1.3.1",
"aurelia-templating-router": "^1.1.0",
"bootstrap": "^3.3.7",
"isomorphic-fetch": "^2.2.1",
"jquery": "^3.1.1"
},
"devDependencies": {
"@types/node": "^6.0.45",
"@easy-webpack/core": "2.0.1",
"webpack": "2.2.0",
"webpack-hot-middleware": "^2.10.0"
},
"aurelia": {
"build": {
"includeDependencies": "aurelia-*"
}
}
}
webpack.config.vendor.js:
var path = require('path');
var common = {
entry: {
vendor: [
'aurelia-event-aggregator',
'aurelia-fetch-client',
'aurelia-framework',
'aurelia-history-browser',
'aurelia-logging-console',
'aurelia-pal-browser',
'aurelia-polyfills',
'aurelia-route-recognizer',
'aurelia-router',
'aurelia-templating-binding',
'aurelia-templating-resources',
'aurelia-templating-router',
'bootstrap',
'bootstrap/dist/css/bootstrap.css',
'jquery'
]
},
output: {
path: path.join(__dirname, 'wwwroot', 'dist'),
publicPath: '/dist/',
filename: '[name].js',
library: '[name]_[hash]'
}
};
var generateConfig = require('@easy-webpack/core').generateConfig;
var config = generateConfig(common);
module.exports = config;