Skip to content

Commit

Permalink
build all .html files, not just index. includes subdirs (#530)
Browse files Browse the repository at this point in the history
Co-authored-by: Shazron Abdullah <36107+shazron@users.noreply.github.com>
  • Loading branch information
purplecabbage and shazron authored Jun 28, 2022
1 parent 9005332 commit 1189c76
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/commands/app/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,14 @@ class Build extends BaseCommand {
if (script) {
spinner.fail(chalk.green(`build-static skipped by hook '${name}'`))
} else {
const entryFile = config.web.src + '/index.html'
const entries = config.web.src + '/**/*.html'
const bundleOptions = {
shouldDisableCache: true,
shouldContentHash: flags['content-hash'],
shouldOptimize: flags['web-optimize'],
logLevel: flags.verbose ? 'verbose' : 'warn'
}
const bundler = await bundle(entryFile, config.web.distProd, bundleOptions, onProgress)
const bundler = await bundle(entries, config.web.distProd, bundleOptions, onProgress)
await bundler.run()
spinner.succeed(chalk.green(`Building web assets for '${name}'`))
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/run-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
if (!options.skipServe) {
const script = await utils.runScript(config.hooks['build-static'])
if (!script) {
const entryFile = config.web.src + '/index.html'
const entries = config.web.src + '/**/*.html'
bundleOptions.serveOptions = {
port: uiPort,
https: bundleOptions.https
Expand All @@ -113,7 +113,7 @@ async function runDev (config, dataDir, options = {}, log = () => {}) {
bundleOptions.additionalReporters = [
{ packageName: '@parcel/reporter-cli', resolveFrom: __filename }
]
defaultBundler = await bundle(entryFile, config.web.distDev, bundleOptions, log)
defaultBundler = await bundle(entries, config.web.distDev, bundleOptions, log)
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions test/commands/app/build.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ describe('run', () => {
expect(command.error).toHaveBeenCalledTimes(0)
expect(mockRuntimeLib.buildActions).toHaveBeenCalledTimes(1)
expect(mockWebLib.bundle).toHaveBeenCalledTimes(1)
expect(mockWebLib.bundle).toHaveBeenCalledWith('/web-src/index.html', '/dist/web-src-prod',
expect(mockWebLib.bundle).toHaveBeenCalledWith('/web-src/**/*.html', '/dist/web-src-prod',
expect.objectContaining({ shouldDisableCache: true, shouldContentHash: true, logLevel: 'warn', shouldOptimize: false }),
expect.any(Function)
)
Expand All @@ -272,7 +272,7 @@ describe('run', () => {
expect(command.error).toHaveBeenCalledTimes(0)
expect(mockRuntimeLib.buildActions).toHaveBeenCalledTimes(1)
expect(mockWebLib.bundle).toHaveBeenCalledTimes(1)
expect(mockWebLib.bundle).toHaveBeenCalledWith('/web-src/index.html', '/dist/web-src-prod',
expect(mockWebLib.bundle).toHaveBeenCalledWith('/web-src/**/*.html', '/dist/web-src-prod',
expect.objectContaining({ shouldDisableCache: true, shouldContentHash: false, logLevel: 'warn', shouldOptimize: false }),
expect.any(Function)
)
Expand All @@ -287,7 +287,7 @@ describe('run', () => {
expect(command.error).toHaveBeenCalledTimes(0)
expect(mockRuntimeLib.buildActions).toHaveBeenCalledTimes(1)
expect(mockWebLib.bundle).toHaveBeenCalledTimes(1)
expect(mockWebLib.bundle).toHaveBeenCalledWith('/web-src/index.html', '/dist/web-src-prod',
expect(mockWebLib.bundle).toHaveBeenCalledWith('/web-src/**/*.html', '/dist/web-src-prod',
expect.objectContaining({ shouldDisableCache: true, shouldContentHash: false, logLevel: 'verbose', shouldOptimize: false }),
expect.any(Function)
)
Expand Down

0 comments on commit 1189c76

Please sign in to comment.