webpack命令后error
webpack.config.js设置应该有问题
Invalid configuration object. Webpack has been initialised using a configuration
object that does not match the API schema.
- configuration.output.path: The provided value "./dist" is not an absolute pat
h!
webpack.config.js设置应该有问题
Invalid configuration object. Webpack has been initialised using a configuration
object that does not match the API schema.
- configuration.output.path: The provided value "./dist" is not an absolute pat
h!
2017-10-20
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
entry: [
'webpack-dev-server/client?http://localhost:3000',
'webpack/hot/only-dev-server',
'react-hot-loader/patch',
path.join(__dirname, 'app/index.js')
],
output: {
path: path.join(__dirname, '/dist/'),
filename: '[name].js',
publicPath: '/'
},
plugins: [
new HtmlWebpackPlugin({
template: './index.tpl.html',
inject: 'body',
filename: './index.html'
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoErrorsPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development')
})
],
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader",
query: {
presets: ['react', 'es2015']
}
}, {
test: /\.css$/,
loader: "style!css"
}, {
test: /\.less/,
loader: "style-loader!css-loader!less-loader"
}
]
}
}你里面的输出路径应该是要绝对路径的,具体原因我也不是很清楚,但是我的这个配置是OK的
举报