Skip to content

Commit 05079e3

Browse files
committed
chore: improve build message
1 parent db26361 commit 05079e3

File tree

1 file changed

+9
-5
lines changed
  • packages/@vue/cli-service/lib/commands/build

1 file changed

+9
-5
lines changed

packages/@vue/cli-service/lib/commands/build/index.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ async function build (args, api, options) {
196196
}
197197

198198
return new Promise((resolve, reject) => {
199+
const isFreshBuild = !fs.existsSync(api.resolve('node_modules/.cache'))
199200
webpack(webpackConfig, (err, stats) => {
200201
stopSpinner(false)
201202
if (err) {
@@ -214,18 +215,21 @@ async function build (args, api, options) {
214215
log(formatStats(stats, targetDirShort, api))
215216
if (args.target === 'app' && !isLegacyBuild) {
216217
if (!args.watch) {
217-
done(`Build complete. The ${chalk.cyan(targetDirShort)} directory is ready to be deployed.\n`)
218+
done(`Build complete. The ${chalk.cyan(targetDirShort)} directory is ready to be deployed.`)
219+
info(`Check out deployment instructions at ${chalk.cyan(`https://cli.vuejs.org/guide/deployment.html`)}\n`)
218220
} else {
219221
done(`Build complete. Watching for changes...`)
220222
}
221223
if (
222224
options.baseUrl === '/' &&
223225
// only log the tips if this is the first build
224-
!fs.existsSync(api.resolve('node_modules/.cache'))
226+
isFreshBuild
225227
) {
226-
info(`The app is built assuming that it will be deployed at the root of a domain.`)
227-
info(`If you intend to deploy it under a subpath, update the ${chalk.green('baseUrl')} option`)
228-
info(`in your project config (${chalk.cyan(`vue.config.js`)} or ${chalk.green('"vue"')} field in ${chalk.cyan(`package.json`)}).\n`)
228+
console.log(
229+
chalk.gray(`Tip: the direcotry is meant to be served by an HTTP server, and will not work if\n` +
230+
`you open it directly over file:// protocol. To preview it locally, use an HTTP\n` +
231+
`server like the ${chalk.yellow(`serve`)} package on npm.\n`)
232+
)
229233
}
230234
}
231235
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy