Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
556 views
in Technique[技术] by (71.8m points)

webpack配置路径出错,各位大神帮忙看一下啊!!速度!!!

图片描述

我的文件夹路径是这样的
webpack下面包含这三个
dist src webpack.config.js

配置:
emodule.exports={

entry:'./src/script/main.js',
output:{
    path:'./dist/js',
    filename:'bundle.js'
}

}
请问路径有错吗,总是报路径错误


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

日志都跟你讲的很清楚了output的path需要是个绝对路径
The output directory as an absolute path (required) 这是官方文档里讲的,你的日志里也提示你了这不是一个绝对路径。
正确用法:

path: path.resolve(__dirname, './dist/js')

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...