6
6
* API: https://github.com/quasarframework/quasar/blob/master/app/lib/app-extension/IndexAPI.js
7
7
*/
8
8
9
- const { merge } = require ( 'webpack-merge' )
9
+ import { extend } from 'quasar'
10
10
11
11
function extendConf ( conf , api ) {
12
12
if ( api . hasVite ) {
13
13
// register our boot file
14
- conf . boot . push ( '~@quasar/quasar-app-extension-qmarkdown/src/boot/vite-register.js' ) ;
14
+ conf . boot . push ( '~@quasar/quasar-app-extension-qmarkdown/src/boot/vite-register.js' )
15
15
} else {
16
16
// register our boot file
17
- conf . boot . push ( '~@quasar/quasar-app-extension-qmarkdown/src/boot/webpack-register.js' ) ;
17
+ conf . boot . push ( '~@quasar/quasar-app-extension-qmarkdown/src/boot/webpack-register.js' )
18
18
19
19
// make sure app extension files & ui packages get transpiled
20
- conf . build . webpackTranspileDependencies = conf . build . webpackTranspileDependencies || [ ] ;
21
- conf . build . webpackTranspileDependencies . push ( / q u a s a r - a p p - e x t e n s i o n - q m a r k d o w n [ \\ / ] s r c / ) ;
22
- conf . build . webpackTranspileDependencies . push ( / q u a s a r - u i - q m a r k d o w n [ \\ / ] s r c / ) ;
20
+ conf . build . webpackTranspileDependencies = conf . build . webpackTranspileDependencies || [ ]
21
+ conf . build . webpackTranspileDependencies . push ( / q u a s a r - a p p - e x t e n s i o n - q m a r k d o w n [ \\ / ] s r c / )
22
+ conf . build . webpackTranspileDependencies . push ( / q u a s a r - u i - q m a r k d o w n [ \\ / ] s r c / )
23
23
}
24
24
25
25
// make sure these plugins are in the build
@@ -30,7 +30,8 @@ function extendConf(conf, api) {
30
30
31
31
// make sure to have 'compilerOptions.isPreTag' available
32
32
if ( api . hasVite === true ) {
33
- conf . build = merge (
33
+ conf . build = extend (
34
+ true ,
34
35
{
35
36
viteVuePluginOptions : {
36
37
template : {
@@ -40,29 +41,34 @@ function extendConf(conf, api) {
40
41
} ,
41
42
} ,
42
43
} ,
43
- conf . build
44
+ conf . build ,
44
45
)
45
46
compilerOptions = conf . build . viteVuePluginOptions . template . compilerOptions
46
47
} else {
47
- conf . build = merge (
48
+ conf . build = extend (
49
+ true ,
48
50
{
49
51
vueLoaderOptions : {
50
52
compilerOptions : {
51
53
isPreTag : ( tag ) => tag === 'pre' || tag === 'q-markdown' || tag === 'QMarkdown' ,
52
54
} ,
53
55
} ,
54
56
} ,
55
- conf . build
57
+ conf . build ,
56
58
)
57
59
compilerOptions = conf . build . vueLoaderOptions . compilerOptions
58
60
}
59
61
60
62
// This needs to be set for Vue 3
61
- const oldPreTagFunc = compilerOptions . isPreTag ;
62
- compilerOptions . isPreTag = ( tag ) => tag === 'pre' || tag === 'q-markdown' || tag === 'QMarkdown' || ( typeof oldPreTagFunc === 'function' ? oldPreTagFunc ( tag ) : false ) ;
63
+ const oldPreTagFunc = compilerOptions . isPreTag
64
+ compilerOptions . isPreTag = ( tag ) =>
65
+ tag === 'pre' ||
66
+ tag === 'q-markdown' ||
67
+ tag === 'QMarkdown' ||
68
+ ( typeof oldPreTagFunc === 'function' ? oldPreTagFunc ( tag ) : false )
63
69
64
70
// make sure the stylesheet goes through webpack to avoid SSR issues
65
- conf . css . push ( '~@quasar/quasar-ui-qmarkdown/src/index.sass' ) ;
71
+ conf . css . push ( '~@quasar/quasar-ui-qmarkdown/src/index.sass' )
66
72
}
67
73
68
74
export default function ( api ) {
@@ -72,13 +78,13 @@ export default function (api) {
72
78
api . compatibleWith ( 'quasar' , '^2.0.0' )
73
79
74
80
if ( api . hasVite === true ) {
75
- api . compatibleWith ( '@quasar/app-vite' , '^2.0.0' ) ;
81
+ api . compatibleWith ( '@quasar/app-vite' , '^2.0.0' )
76
82
} else {
77
- api . compatibleWith ( '@quasar/app-webpack' , '^4.0.0' ) ;
83
+ api . compatibleWith ( '@quasar/app-webpack' , '^4.0.0' )
78
84
}
79
85
80
86
// Uncomment the line below if you provide a JSON API for your component
81
- api . registerDescribeApi ( 'QMarkdown' , '~@quasar/quasar-ui-qmarkdown/dist/api/QMarkdown.json' ) ;
87
+ api . registerDescribeApi ( 'QMarkdown' , '~@quasar/quasar-ui-qmarkdown/dist/api/QMarkdown.json' )
82
88
83
89
// We extend /quasar.conf.js
84
90
api . extendQuasarConf ( extendConf )
@@ -87,17 +93,21 @@ export default function (api) {
87
93
if ( api . hasWebpack === true ) {
88
94
// chain webpack
89
95
api . chainWebpack ( ( chain , { isClient, isServer } , api ) => {
90
- console . log ( " App Extension (qmarkdown) Info: 'Adding markdown loader (*.md) to chainWebpack'" ) ;
91
- chain . module . rule ( 'md' ) . test ( / \. m d $ / i) . use ( 'raw-loader' ) . loader ( 'raw-loader' ) ;
92
- } ) ;
96
+ console . log (
97
+ " App Extension (qmarkdown) Info: 'Adding markdown loader (*.md) to chainWebpack'" ,
98
+ )
99
+ chain . module . rule ( 'md' ) . test ( / \. m d $ / i) . use ( 'raw-loader' ) . loader ( 'raw-loader' )
100
+ } )
93
101
}
94
102
if ( api . hasVite === true ) {
95
103
api . extendViteConf ( ( viteConf , { isClient, isServer } , api ) => {
96
- console . log ( " App Extension (qmarkdown) Info: 'Adding markdown loader (*.md) to extendViteConf'" ) ;
104
+ console . log (
105
+ " App Extension (qmarkdown) Info: 'Adding markdown loader (*.md) to extendViteConf'" ,
106
+ )
97
107
viteConf . plugins . push (
98
108
viteRawImporter ( {
99
109
fileRegex : / \. m d $ / ,
100
- } )
110
+ } ) ,
101
111
)
102
112
} )
103
113
}
0 commit comments