Skip to content

Vue component mode doesn't work on Vue 3 project due to this plugin is stuck on Vue 2 compiler; vue-template-compiler #238

@yuigoto

Description

@yuigoto

Hi!

I'm building a custom Webpack-based Vue project in here using vue-loader, for an educational project I'm working on. But I'm having issues with this library. I've used it the same way I did with a React project of the same nature:

config.plugins = [
  // ... other plugins here
  {
    test: /\.vue$/,
    use: "vue-loader",
  },

  {
    test: /\.md$/,
    loader: "frontmatter-markdown-loader",
    options: {
      mode: [
        mode.VUE_COMPONENT
      ],
      vue: {
        root: "markdown-content",
      },
    },
  },
  // ... other plugins here
];

config.plugins = [
  new VueLoaderPlugin(),
];

But I've had this issue, importing a Markdown file:

ERROR in ./src/views/Main.vue
Module build failed (from ./node_modules/frontmatter-markdown-loader/index.js):
Error: Failed to import vue-template-compiler or/and @vue/component-compiler-utils:
If you intend to use 'vue-component', `vue-render-functions` mode, install both to your project:
https://hmsk.github.io/frontmatter-markdown-loader/vue.html 
    at Object.module.exports (F:\Git\GitHub\vue-webpack-base\node_modules\frontmatter-markdown-loader\index.js:73:13)
 @ ./src/index.js 2:0-34 6:22-26

I've also tried using the loader like this, for MD files, to no success:

config.plugins = [
  // ... other plugins here
  {
    test: /\.md$/,
    use: [
      "vue-loader",
      {
        loader: "frontmatter-markdown-loader",
        options: {
          mode: [
            mode.VUE_COMPONENT
          ],
          vue: {
            root: "markdown-content",
          },
        },
      },
    ],
  },
  // ... other plugins here
];

I'm currently using Vue @ 3.1.4, with @vue/compiler-sfc (^3.1.4) and @vue/component-compiler-utils (^3.2.2), and I tried installing vue-template-compiler, but I'm stuck with this error.

I'm wondering if I'm doing something wrong, or loading it the wrong way, or if I should explicitly declare vue-loader to use @vue/compiler-sfc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions