mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-27 07:09:16 -05:00
fix: improve error message when entry is missing w/ --target lib
close #1051
This commit is contained in:
@@ -1,15 +1,31 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
module.exports = (api, { entry, name }, options) => {
|
||||
// setting this disables app-only configs
|
||||
process.env.VUE_CLI_TARGET = 'lib'
|
||||
// inline all static asset files since there is no publicPath handling
|
||||
process.env.VUE_CLI_INLINE_LIMIT = Infinity
|
||||
|
||||
const { log, error } = require('@vue/cli-shared-utils')
|
||||
const abort = msg => {
|
||||
log()
|
||||
error(msg)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
if (!fs.existsSync(api.resolve(entry))) {
|
||||
abort(
|
||||
`Failed to resolve lib entry: ${entry}${entry === `src/App.vue` ? ' (default)' : ''}. ` +
|
||||
`Make sure to specify the correct entry file.`
|
||||
)
|
||||
}
|
||||
|
||||
const libName = (
|
||||
name ||
|
||||
api.service.pkg.name ||
|
||||
path.basename(entry).replace(/\.(jsx?|vue)$/, '')
|
||||
)
|
||||
// setting this disables app-only configs
|
||||
process.env.VUE_CLI_TARGET = 'lib'
|
||||
// inline all static asset files since there is no publicPath handling
|
||||
process.env.VUE_CLI_INLINE_LIMIT = Infinity
|
||||
|
||||
function genConfig (format, postfix = format, genHTML) {
|
||||
const config = api.resolveChainableWebpackConfig()
|
||||
|
||||
Reference in New Issue
Block a user