Skip to content

Commit

Permalink
feat(release): v1.8.15
Browse files Browse the repository at this point in the history
  • Loading branch information
ckken committed Apr 8, 2021
1 parent 3201eae commit fe92a26
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
7 changes: 7 additions & 0 deletions packages/emp-cli/helpers/serveTool.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ function getHostname(hostname) {
}
return hostname
}
function getDevHost(host) {
if (!host) {
host = internalIp.v4.sync() || internalIp.v6.sync() || 'localhost'
}
return host
}

module.exports = {
getHostname,
getDevHost,
}
2 changes: 1 addition & 1 deletion packages/emp-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@efox/emp-cli",
"version": "1.8.14",
"version": "1.8.15",
"keywords": [
"react",
"module federation",
Expand Down
6 changes: 3 additions & 3 deletions packages/emp-cli/scripts/dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const Webpack = require('webpack')
const WebpackDevServer = require('webpack-dev-server')
const openBrowser = require('../helpers/openBrowser')
// const downloadRemoteFile = require('../helpers/downloadRemoteFile')
const {getHostname} = require('../helpers/serveTool')
const {getHostname, getDevHost} = require('../helpers/serveTool')
module.exports = async args => {
const {src, public, open, remote} = args
await setPaths({src, public})
Expand All @@ -22,8 +22,8 @@ module.exports = async args => {
//
const compiler = Webpack(config)
const server = new WebpackDevServer(compiler, config.devServer)
const host = getHostname(config.devServer.host) || 'localhost'
server.listen(config.devServer.port, host, err => {
const host = getDevHost(config.devServer.host)
server.listen(config.devServer.port, '0.0.0.0', err => {
if (err) {
console.error(err)
return
Expand Down
3 changes: 1 addition & 2 deletions packages/emp-cli/webpack/config/devServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ module.exports = (env, {hot, open, progress}) => {
// compress: true,
// host: '0.0.0.0',
// host: 'localhost',
//::TODO 设置后 localhost 不能访问
host: 'local-ip',
// host: 'local-ip',
port: 8000,
// contentBase: [public],
// contentBasePublicPath :'/',//定义静态路径的别名
Expand Down

0 comments on commit fe92a26

Please sign in to comment.