我无法将mp3文件更新为我的音频标签
GET http://localhost:3000/songs/Jason_Shaw-Running_Waters.mp3 [HTTP / 1.1 404未找到1ms]
var webpack = require('webpack')
var webpackDevMiddleware = require('webpack-dev-middleware')
var webpackHotMiddleware = require('webpack-hot-middleware')
var config = require('./webpack.config')
var app = new (require('express'))()
var port = 3000
var compiler = webpack(config)
app.use(webpackDevMiddleware(compiler, { noInfo: true, publicPath: config.output.publicPath }))
app.use(webpackHotMiddleware(compiler))
app.get("/", function(req, res) {
res.sendFile(__dirname + '/index.html')
})
app.listen(port, function(error) {
if (error) {
console.error(error)
} else {
console.info("Open up http://localhost:%s/ in your browser.", port, port)
}
})
你能解释一下我如何编辑我的server.js文件以获得适当的结果。我是否需要在我的webpack.config.js中为mp3文件添加任何加载器?
答案 0 :(得分:0)
得到了一些有才华的人的答案!
app.use('/songs', express.static(__dirname + '/songs'));
是啊!