Merge pull request #1038 from mozilla/fix-npm-run-android

Fix npm run android by removing the <base href> when running under the dev server
This commit is contained in:
Danny Coates 2018-12-13 09:27:53 -08:00 committed by GitHub
commit 8cde99d2a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,9 +18,10 @@ module.exports = function(app, devServer) {
assets.setMiddleware(devServer.middleware); assets.setMiddleware(devServer.middleware);
app.use(morgan('dev', { stream: process.stderr })); app.use(morgan('dev', { stream: process.stderr }));
function android(req, res) { function android(req, res) {
const index = devServer.middleware.fileSystem.readFileSync( const index = devServer.middleware.fileSystem
devServer.middleware.getFilenameFromUrl('/android.html') .readFileSync(devServer.middleware.getFilenameFromUrl('/android.html'))
); .toString()
.replace('<base href="file:///android_asset/" />', '');
res.set('Content-Type', 'text/html'); res.set('Content-Type', 'text/html');
res.send(index); res.send(index);
} }