mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-21 23:00:00 -06:00
17 lines
492 B
JavaScript
17 lines
492 B
JavaScript
const path = require('path')
|
|
|
|
module.exports = function getAssetPath (options, filePath, placeAtRootIfRelative) {
|
|
// if the user is using a relative URL, place js & css at dist root to ensure
|
|
// relative paths work properly
|
|
if (
|
|
placeAtRootIfRelative &&
|
|
!(/^https?:/.test(options.baseUrl)) &&
|
|
options.baseUrl.charAt(0) !== '/'
|
|
) {
|
|
return filePath.replace(/^\w+\//, '')
|
|
}
|
|
return options.assetsDir
|
|
? path.posix.join(options.assetsDir, filePath)
|
|
: filePath
|
|
}
|