File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import { posix as path } from 'path'
2+ import { NuxtOptions } from '@nuxt/types'
3+
4+ export function joinUrl ( ...args : string [ ] ) {
5+ return path . join ( ...args ) . replace ( ':/' , '://' )
6+ }
7+
8+ export function isUrl ( url : string ) {
9+ return url . indexOf ( 'http' ) === 0 || url . indexOf ( '//' ) === 0
10+ }
11+
12+ export function getRouteParams ( options : NuxtOptions ) {
13+ // routerBase
14+ const routerBase = options . router . base
15+
16+ // publicPath
17+ let publicPath
18+ if ( isUrl ( options . build . publicPath ) ) {
19+ publicPath = options . build . publicPath
20+ } else {
21+ publicPath = joinUrl ( routerBase , options . build . publicPath )
22+ }
23+
24+ return {
25+ routerBase,
26+ publicPath
27+ }
28+ }
29+
30+ module . exports = {
31+ joinUrl,
32+ getRouteParams
33+ }
You can’t perform that action at this time.
0 commit comments