Skip to content

Commit

Permalink
fix: Didn't generate files in spa mode.(close #9)
Browse files Browse the repository at this point in the history
  • Loading branch information
wangyi7099 committed Nov 26, 2019
1 parent d4cc8ad commit c9d2dd5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/@rcpress/core/lib/node/commands/spa/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ module.exports = async function dev(sourceDir, cliOptions = {}, isProd) {
} = require('@rcpress/webpack');
const { applyUserWebpackConfig, logger, resolveHostandPort } = require('@rcpress/util');

const webpack = require('webpack');

logger.wait('\nExtracting site metadata...');

const options = await prepare(sourceDir);
Expand Down Expand Up @@ -99,9 +101,15 @@ module.exports = async function dev(sourceDir, cliOptions = {}, isProd) {
compilerDoneReporterOpts.port
);
} else {
// generate service worker config.
if (options.siteData.serviceWorker) {
buildSW(options.outDir);
}
webpack(config, (err, stats) => {
if (err) {
throw err;
}

// generate service worker config.
if (options.siteData.serviceWorker) {
buildSW(options.outDir);
}
});
}
};
1 change: 1 addition & 0 deletions packages/@rcpress/core/lib/node/sw/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ module.exports = async function(outDir) {
await fs.readFile(path.resolve(__dirname, './skip-waiting.js'), 'utf8'),
{ flag: 'a' }
);
logger.success('\nGenerated service worker successfully!');
};

0 comments on commit c9d2dd5

Please sign in to comment.