Tapable.plugin is deprecated. Use new API on `.hooks` instead

来源:5-3 服务端渲染的entry配置

warzsy

2018-09-07

extract-text-webpack-plugin换成mini-css-extract-plugin了还是报这个错误
图片描述
webpack.config.server.js 代码:
const path = require(‘path’)
const webpack = require(‘webpack’)
const merge = require(‘webpack-merge’)
const baseConfig = require(’./webpack.config.base’)
const VueServerPlugin = require(‘vue-server-renderer/server-plugin’)
const VueLoaderPlugin = require(‘vue-loader/lib/plugin’)
const MiniCssExtractPlugin = require(“mini-css-extract-plugin”)

let config
config = merge(baseConfig,{
target: ‘node’,
entry: path.join(__dirname, ‘…/client/server-entry.js’),
devtool: ‘source-map’,
output: {
libraryTarget: ‘commonjs2’,
filename: ‘server-entry.js’,
path: path.join(__dirname, ‘…/server-build’)
},
externals: Object.keys(require(’…/package.json’).dependencies),
module:{
rules:[
{
test: /.styl/,
use: [
{
loader:MiniCssExtractPlugin.loader,
options:{
publicPath: ‘…/’
}
},
‘css-loader’,
{
loader:‘postcss-loader’,
options:{
sourceMap:true,
}
},
‘stylus-loader’
]
},
{
test: /.css$/,
use: [
‘vue-style-loader’,
{
loader: ‘css-loader’,
options: {
// enable CSS Modules
modules: true,
// customize generated class names
localIdentName: ‘[path]-[name]-[hash:base64:5]’,
camelCase:true
}
}
]
}
]
},
plugins: [
// new ExtractPlugin(‘styles.[chunkhash:8].css’),
new webpack.DefinePlugin({
‘process.env.NODE_ENV’: JSON.stringify(process.env.NODE_ENV || ‘development’),
‘process.env.VUE_ENV’: ‘“server”’
}),
new VueServerPlugin(),
new VueLoaderPlugin(),
new MiniCssExtractPlugin({
filename: “[name].css”,
})
]
})

module.exports = config

webkack版本:4.17.2 (最新)图片描述

写回答

5回答

Jokcy

2018-09-10

这个提醒本身不会导致错误啊,现在版本的webpack还是支持老的API的,只是会在下个版本移除。这么看我也是看不出哪里的问题,你也没必要特别在意

0
1
warzsy
好的 那就之后有问题再解决吧~谢谢
2018-09-11
共1条回复

叶赫那拉鬼龙

2019-02-18

//img.mukewang.com/szimg/5c6a6ddd00019b0a04360118.jpg我是把这三个的版本号改成一样的 就没有这个提示了

0
0

夜尽天明4039292

2018-10-19

遇到同样的问题,请问你解决了吗,怎么解决的呢?
0
0

Jokcy

2018-09-10

另外如果你确定是VueServerPlugin的问题,可以去github找issue或者你自己提一个

0
0

Jokcy

2018-09-08

这是插件版本没有更新,用的老的webpack版本api的原因,你可以升级一下插件

0
5
Jokcy
回复
warzsy
这个问题并不影响使用啊,有可能就是插件确实没更新
2018-10-23
共5条回复

Vue核心技术 Vue+Vue-Router+Vuex+SSR实战精讲

深入讲解Vue核心技术,展示Vue应用开发中的各种问题和解决方案

3168 学习 · 853 问题

查看课程