看vuex 的例子,有一個(gè)配置不清楚,在vuex examples server.js 中一個(gè)配置 publicPath: '/__build__/' , '/__build__/'是在那個(gè)目錄,運(yùn)行起來沒有這個(gè)目錄?配置://server.jsconst express = require('express')const webpack = require('webpack')const webpackDevMiddleware = require('webpack-dev-middleware')const webpackHotMiddleware = require('webpack-hot-middleware')const WebpackConfig = require('./webpack.config')const app = express()const compiler = webpack(WebpackConfig)
app.use(webpackDevMiddleware(compiler, {
publicPath: '/__build__/',//這個(gè)路徑是在那?
stats: {
colors: true,
chunks: false
}
}))
app.use(webpackHotMiddleware(compiler))
app.use(express.static(__dirname))const port = process.env.PORT || 8080module.exports = app.listen(port, () => {
console.log(`Server listening on http://localhost:${port}, Ctrl+C to stop`)})vuex的源碼:https://github.com/vuejs/vuex...
1 回答

慕妹3146593
TA貢獻(xiàn)1820條經(jīng)驗(yàn) 獲得超9個(gè)贊
這個(gè)是 用在代碼中的路徑。表示所有的靜態(tài)資源都要加這個(gè)前綴拼接。
比如,你的css中寫了一個(gè) background: url(../images/a.png) ,打包后就變成了 /__build__/../images/a.png
一般上線就會(huì)替換成 cdn的地址
- 1 回答
- 0 關(guān)注
- 1010 瀏覽
添加回答
舉報(bào)
0/150
提交
取消