Browse Source

参数配置传递及使用

master
巴林闲侠 2 years ago
parent
commit
3964e75dfd
  1. 1
      web/config.js
  2. 4
      web/middlewares/webpack-dev.js

1
web/config.js

@ -50,6 +50,7 @@ const product = {
port: flags.port || 8080, port: flags.port || 8080,
staticDirs: [path.join(__dirname, './client')], staticDirs: [path.join(__dirname, './client')],
frontParams: { frontParams: {
// 以大写字母命名
API_ROOT: FS_UNIAPP_API API_ROOT: FS_UNIAPP_API
}, },
mws: [ mws: [

4
web/middlewares/webpack-dev.js

@ -20,7 +20,7 @@ module.exports = {
})() })()
}), }),
) )
const compiler = webpack(devConfig); const compiler = webpack(devConfig);
app.use(proxy('http://localhost:5401', { app.use(proxy('http://localhost:5401', {
@ -40,7 +40,7 @@ module.exports = {
return 'client/build/index.html'; return 'client/build/index.html';
} }
})); }));
const server = express(); const server = express();
server.use(middleware(compiler)); server.use(middleware(compiler));
//server.use(require("webpack-hot-middleware")(compiler)); //server.use(require("webpack-hot-middleware")(compiler));

Loading…
Cancel
Save