无法输出打包后的文件。
var config = {
entry: './index.js',
output: {
path: './',
filename: 'bundle.js'
},
devServer: {
inline: true,
port: 7777
},
module: {
loaders: [
{text: /.js?$/, exclude: /node_modules/, loader: 'babel', query: {presets: ['es2015', 'react']}}
]
}
}
module.export = config;
这是webpack.config.js
在index.html中引入的 ./bundle.js 但是控制台显示找不到这个文件,会是什么原因呢?
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
那你至少得确定,和
index.html同目录下,是否有bundle.js文件可能路径不对吧
看配置没有问题,肯定是引入路径的问题啊
你是用webpack-dev-server预览的?
你这问题没说清楚……
如果使用webpack-dev-server它使用的都是缓存的文件,而不是你写的路径……
所以,这样的话,你最好用webpackHtmlPlugins这个插件;
推荐文章跟着跑跑,有两篇
执行
webpack才会进行打包,最后才能输出bundle.js文件