nuxt-community / markdownit-module

Markdownit for Nuxt 2
MIT License
48 stars 11 forks source link

markdownit not working with nuxt-edge #11

Closed bskimball closed 3 years ago

bskimball commented 6 years 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

This bug report is available on Nuxt community (#c128)
bskimball commented 6 years 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

bskimball commented 6 years 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

waleeddogar commented 6 years 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

leopoldkristjansson commented 6 years ago

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

manniL commented 6 years ago

Fixed with nuxt-community/community-modules#208 and https://github.com/nuxt-community/modules/releases/tag/%40nuxtjs%2Fmarkdownit%401.2.2

Thanks to @bskimball ☺️

ghost commented 6 years ago

This bug-report has been fixed by @bskimball.

leopoldkristjansson commented 6 years 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",