-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.ts
executable file
·54 lines (49 loc) · 1.34 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { RouteConfig } from 'vue-router';
import pkg from './package.json';
const ENV = process.env.NODE_ENV || 'development';
const IS_PRODUCTION = ENV === 'production';
const ROUTER_BASE = IS_PRODUCTION ? `/${pkg.name}/` : undefined;
const mode = IS_PRODUCTION ? 'spa' : undefined;
const routerMode = IS_PRODUCTION ? 'hash' : undefined;
export default {
mode,
srcDir: 'src/',
generate: {
dir: 'docs',
},
router: {
base: ROUTER_BASE,
mode: routerMode,
extendRoutes(routes: RouteConfig[], resolve: Function) {
routes.push(
{
path: '/basic',
name: 'basic',
component: resolve(__dirname, 'src/views/List.vue'),
},
{
path: '/basic/:id',
name: 'basic-item',
component: resolve(__dirname, 'src/views/Item.vue'),
},
{
path: '/keepalive',
component: resolve(__dirname, 'src/views/KeepAlive.vue'),
children: [
{
path: '/',
name: 'keepalive-index',
component: resolve(__dirname, 'src/views/List.vue'),
},
{
path: ':id',
name: 'keepalive-item',
component: resolve(__dirname, 'src/views/Item.vue'),
},
],
},
);
},
},
plugins: ['~/plugins/lib'],
};