66 * API: https://github.com/quasarframework/quasar/blob/master/app/lib/app-extension/IndexAPI.js
77 */
88
9- const { merge } = require ( 'webpack-merge' )
9+ import { extend } from 'quasar'
1010
1111function extendConf ( conf , api ) {
1212 if ( api . hasVite ) {
1313 // 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' )
1515 } else {
1616 // 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' )
1818
1919 // 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 / )
2323 }
2424
2525 // make sure these plugins are in the build
@@ -30,7 +30,8 @@ function extendConf(conf, api) {
3030
3131 // make sure to have 'compilerOptions.isPreTag' available
3232 if ( api . hasVite === true ) {
33- conf . build = merge (
33+ conf . build = extend (
34+ true ,
3435 {
3536 viteVuePluginOptions : {
3637 template : {
@@ -40,29 +41,34 @@ function extendConf(conf, api) {
4041 } ,
4142 } ,
4243 } ,
43- conf . build
44+ conf . build ,
4445 )
4546 compilerOptions = conf . build . viteVuePluginOptions . template . compilerOptions
4647 } else {
47- conf . build = merge (
48+ conf . build = extend (
49+ true ,
4850 {
4951 vueLoaderOptions : {
5052 compilerOptions : {
5153 isPreTag : ( tag ) => tag === 'pre' || tag === 'q-markdown' || tag === 'QMarkdown' ,
5254 } ,
5355 } ,
5456 } ,
55- conf . build
57+ conf . build ,
5658 )
5759 compilerOptions = conf . build . vueLoaderOptions . compilerOptions
5860 }
5961
6062 // 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 )
6369
6470 // 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' )
6672}
6773
6874export default function ( api ) {
@@ -72,13 +78,13 @@ export default function (api) {
7278 api . compatibleWith ( 'quasar' , '^2.0.0' )
7379
7480 if ( api . hasVite === true ) {
75- api . compatibleWith ( '@quasar/app-vite' , '^2.0.0' ) ;
81+ api . compatibleWith ( '@quasar/app-vite' , '^2.0.0' )
7682 } else {
77- api . compatibleWith ( '@quasar/app-webpack' , '^4.0.0' ) ;
83+ api . compatibleWith ( '@quasar/app-webpack' , '^4.0.0' )
7884 }
7985
8086 // 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' )
8288
8389 // We extend /quasar.conf.js
8490 api . extendQuasarConf ( extendConf )
@@ -87,17 +93,21 @@ export default function (api) {
8793 if ( api . hasWebpack === true ) {
8894 // chain webpack
8995 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+ } )
93101 }
94102 if ( api . hasVite === true ) {
95103 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+ )
97107 viteConf . plugins . push (
98108 viteRawImporter ( {
99109 fileRegex : / \. m d $ / ,
100- } )
110+ } ) ,
101111 )
102112 } )
103113 }
0 commit comments