forked from nativescript-vue/nativescript-vue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnativescript.webpack.js
65 lines (55 loc) · 1.69 KB
/
nativescript.webpack.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
62
63
64
65
const { VueLoaderPlugin } = require('vue-loader');
/**
* @param {typeof import("@nativescript/webpack")} webpack
*/
module.exports = (webpack) => {
webpack.useConfig('vue');
webpack.chainWebpack((config) => {
// resolve any imports from "vue" to "nativescript-vue"
config.resolve.alias.set('vue', 'nativescript-vue');
config.plugins.get('VueLoaderPlugin').use(VueLoaderPlugin);
// use "vue-loader" from "nativescript-vue" deps rather than the one from @nativescript/webpack
config.module.rules
.get('vue')
.uses.get('vue-loader')
.loader(require.resolve('vue-loader'))
.tap((options) => {
return {
...options,
isServerBuild: false,
compilerOptions: {
// isCustomElement: (el) => el.toLowerCase() === 'label',
// transformHoist: null
},
};
});
config.module.rules
.get('css')
.uses.get('vue-css-loader')
.loader(require.resolve('vue-loader/dist/stylePostLoader.js'));
config.module.rules
.get('scss')
.uses.get('vue-css-loader')
.loader(require.resolve('vue-loader/dist/stylePostLoader.js'));
config.plugin('DefinePlugin').tap((args) => {
Object.assign(args[0], {
__VUE_OPTIONS_API__: true,
__VUE_PROD_DEVTOOLS__: false,
});
return args;
});
// disable vue fork ts checker, as it doesn't work with vue3 yet?
config.plugin('ForkTsCheckerWebpackPlugin').tap((args) => {
args[0] = webpack.merge(args[0], {
typescript: {
extensions: {
vue: {
enabled: false,
},
},
},
});
return args;
});
});
};