Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,21 @@ module.exports = app => {
throw new Error('check autoPort fail');
}
}
const protocol = app.options.https && assetsConfig.dynamicLocalIP ? 'https' : 'http';
assetsConfig.url = `${protocol}://127.0.0.1:${port}`;
// if not set url,it will be `127.0.0.1:${devServer.port}`
if (assetsConfig.url) {
assetsConfig.url = `${assetsConfig.url}:${port}`;
} else {
const protocol = app.options.https && assetsConfig.dynamicLocalIP ? 'https' : 'http';
assetsConfig.url = `${protocol}://127.0.0.1:${port}`;
}
}

// it should check manifest.json on deployment
if (!assetsConfig.isLocalOrUnittest) {
const manifestPath = path.join(app.config.baseDir, 'config/manifest.json');
const manifestPath = path.join(
app.config.baseDir,
'config/manifest.json'
);
assert(fs.existsSync(manifestPath), `${manifestPath} is required`);
assetsConfig.manifest = require(manifestPath);
}
Expand Down
2 changes: 1 addition & 1 deletion config/config.default.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = appInfo => ({
/**
* assets options
* @member Config#assets
* @property {String} url - the host of the assets, it will be `http://127.0.0.1:${devServer.port}` in development.
* @property {String} url - the host of the assets,if not set,it will be `127.0.0.1:${devServer.port}` in development.
* @property {String} publicPath - the base path of the assets
* @property {String} templatePath - the file path of template rendering html
* @property {String} templateViewEngine - the view engine for rendering template
Expand Down