markdownit not working with nuxt-edge

bskimball
18
bskimball
commented 7 months ago

Version

2

Steps to reproduce

When running @nuxtjs/markdownit with nuxt-edge, the build files with cannot read 'md' of undefined.

× fatal TypeError: Cannot set property 'md' of undefined
  at Builder.extendBuild.config (C:\wamp64\www\bdk-nuxt\node_modules\@nuxtjs\markdownit\index.js:21:39)
  at Builder.<anonymous> (C:\wamp64\www\bdk-nuxt\node_modules\nuxt-edge\dist\nuxt.js:149:23)
  at WebpackClientConfig.config (C:\wamp64\www\bdk-nuxt\node_modules\nuxt-edge\dist\nuxt.js:3017:56)
  at Builder.webpackBuild (C:\wamp64\www\bdk-nuxt\node_modules\nuxt-edge\dist\nuxt.js:3588:56)
  at Builder.build (C:\wamp64\www\bdk-nuxt\node_modules\nuxt-edge\dist\nuxt.js:3299:16)
  at <anonymous>
Nuxt Fatal Error :(

It looks to be when trying to add markdownitLoader to vueLoader in line 22 of index.js. on this command vueLoader.query.loaders['md'] = markDownItLoader. vueLoader.query.loaders is returning as undefined.

What is expected ?

To be able to use markdown files

What is actually happening?

build failure

bug
0

Fixed

4 months ago by manniL

0
bskimball
18
bskimball
commented 7 months ago

Upon further review:
the vueLoader object is as follows

{ 
  test: /\.vue$/,
    loader: 'vue-loader',
    options: { 
      productionMode: true,
      transformAssetUrls: { 
        video: 'src', 
        source: 'src', 
        object: 'src', 
        embed: 'src'
      }
   }
}

the module is looking for loaders which does not exist under options. It looks like we need to check if loaders already exist, if they don't then we need to create the loaders object. I can create a PR

0
bskimball
18
bskimball
commented 6 months ago

I created a PR for this a couple weeks ago. Can we see that it gets reviewed and merged?

https://github.com/nuxt-community/modules/pull/208

0
waleeddogar
0
waleeddogar
commented 5 months ago

I pushed to my own npm registry until they create a new release. Hopefully this can help you a little
https://www.npmjs.com/package/@digibytes/markdownit

0
leopoldkristjansson
0
leopoldkristjansson
commented 4 months ago

This is an issue for me with Nuxt 2.0 - using @waleeddogar version seems to work. Thanks!

0
leopoldkristjansson
0
leopoldkristjansson
commented 4 months ago

This bug-report has been fixed by @bskimball.

Thank you, this seems to work well now using Nuxt 2.0.0 and "@nuxtjs/markdownit": "^1.2.2",

0
Informations
Bug ReportFixed
#c128 - Created 7 months ago