vue webpack 手动配置后 npm run dev 报错 求救
webpack
const path = require('path');
const HTMLPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const VueLoaderPlugin = require('vue-loader/lib/plugin');
const isDev = process.env.NODE_EVN === 'development';
const config = {
target:'web',
entry: path.join(__dirname, 'src/index.js'),
output: {
filename: 'bundle.js',
path: path.join(__dirname, 'dist')
},
plugins: [
new VueLoaderPlugin(),
new webpack.DefinePlugin({
'process.env':{
NODE_EVN:isDev?'"development"' : '"production"'
}
}),
new HTMLPlugin()
],
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue-loader'
},
{
test: /\.css$/,
use:[
'style-loader',
'css-loader'
]
},
{
test:'/\.styl',
use:[
'style-loader',
'css-loader',
'stylus-loader'
]
},
{
test: /\.(gif|jpg|jpeg|png|svg)$/,
use:[
{
loader:'url-loader',
options:{
limit:1024,
name:'[name].[ext]'
}
}
]
}
]
}
}
if(isDev){
config.devServer = {
port:8090,
host:'0.0.0.0',
overlay:{
errors:true
}
}
}
module.exports = config;
package
{
"name": "ssr-test",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "cross-env NODE_ENV=production webpack --config webpack.config.js",
"dev": "cross-env NODE_ENV=development webpack-dev-server --config webpack.config.js"
},
"author": "",
"license": "ISC",
"dependencies": {
"cross-env": "^7.0.3",
"css-loader": "^5.2.0",
"file-loader": "^6.2.0",
"html-webpack-plugin": "^5.3.1",
"style-loader": "^2.0.0",
"stylus": "^0.54.8",
"stylus-loader": "^5.0.0",
"url-loader": "^4.1.1",
"vue": "^2.6.12",
"vue-loader": "^15.9.6",
"vue-template-compiler": "^2.6.12",
"webpack-serve": "^3.2.0"
},
"devDependencies": {
"webpack-cli": "^4.6.0"
},
"description": ""
}
报错
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这样写呢