-
Notifications
You must be signed in to change notification settings - Fork 1
/
vue.config.js
61 lines (53 loc) · 1.74 KB
/
vue.config.js
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
55
56
57
58
59
60
61
/* eslint-disable @typescript-eslint/no-var-requires */
const { join: joinPath, resolve: resolvePath } = require('path');
const mock = require('mocker-api');
const { DEMO_ROOT_DIR, VUE_APP_DIR } = require('./scripts/helper');
const APP_PATH = `./${VUE_APP_DIR}`;
function resolve(dir) {
return joinPath(__dirname, dir);
}
module.exports = {
publicPath: process.env.NODE_ENV === 'production' ? '/preview/vue/' : '/',
configureWebpack: {
entry: {
app: `${APP_PATH}/src/main.ts`,
},
resolve: {
alias: {
'@handie/runtime-core/dist': resolve('./packages/runtime-core/src'),
'@handie/runtime-core': resolve('./packages/runtime-core/src/index.ts'),
'handie-vue/dist': resolve('./packages/handie-vue/src'),
'handie-vue': resolve('./packages/handie-vue/src/index.ts'),
'@handie/bulbasaur/dist': resolve('./packages/bulbasaur/src'),
'@handie/bulbasaur': resolve('./packages/bulbasaur/src/index.ts'),
'@_': resolve(`./${DEMO_ROOT_DIR}/common`),
'@': resolve(`${APP_PATH}/src/shared`),
},
},
},
chainWebpack: config => {
config.plugin('html').tap(args => {
args[0].template = resolve(`${APP_PATH}/public/index.html`);
return args;
});
config.plugin('fork-ts-checker').tap(args => {
args[0].tsconfig = resolve(`${APP_PATH}/tsconfig.json`);
return args;
});
},
css: {
loaderOptions: {
sass: {
implementation: require('sass'),
sassOptions: {
fiber: require('fibers'),
},
additionalData: `@import "kokiri/dist/themes/antd/helper";`,
},
},
},
devServer: {
disableHostCheck: true,
before: app => mock(app, resolvePath(`./${DEMO_ROOT_DIR}/mock/index.js`)),
},
};