question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Loader for custom blocks

See original GitHub issue

Hi!

When I try to add the <route-meta> to a page i get the following error:

Module parse failed: Unexpected token (3:22)
You may need an appropriate loader to handle this file type.
|
| {
>   "requerAutenticacao": true
| }
|

It looks like we have to implement a loader for this custom tag.

So, I’d like to make a suggestion: why not add the “how-to” on the docs under metadata? Maybe offer a default implementation inside the library as an option.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
tomiericcommented, Dec 5, 2018

In my project, create new file meta-loader.js

module.exports = function (source, map) {
  this.callback(
    null,
    `export default function (Component) {
      Component.options._meta = ${
        JSON.stringify(source)
      }
    }`,
    map
  )
}

In your webpack.config.js, add like this:

...
module: {
      rules: [
        {
          resourceQuery: /blockType=route-meta/,
          loader: require.resolve('./meta-loader.js')
        }
     ]
}
...

In my project to cmmand yarn dev, Oh yeah! It’s look like Ok

https://vue-loader.vuejs.org/guide/custom-blocks.html#example

I’m created a webpack plugin to use vue-route-generator, bucase want to support mutil-pages, The project vue-cli-plugin-auto-routing didn’t.

0reactions
ThaDaVoscommented, Feb 24, 2020

NVM, it’s an issue with the vuetify-loader - it’s trying to load the block while it shouldn’t…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Blocks | Vue Loader
You can define custom language blocks inside *.vue files. Loaders applied for a custom block are matched based on the lang attribute of...
Read more >
intlify/vue-i18n-loader - GitHub
The locale messages defined at i18n custom blocks are json format default. Source importing. you also can: <i18n src="./myLang ...
Read more >
Vuejs - custom loader to manipulate SFC template block
I'd like to manipulate Vue SFCs 'template' blocks during Webpack compilation. The goal. Being able to (mainly) remove some parts based on ...
Read more >
Replacing create-guten-block with a custom Webpack
It's a little longer. This file tells Webpack what files to look for and what to do with them – it will use...
Read more >
Loader - Genesis Custom Blocks (1.5.1) - PluginTests.com
Home · Genesis Custom Blocks · 1.5.1 (latest) · Code · Classes; Loader. Genesis\CustomBlocks\Blocks\Loader A. Total Complexity, 69. Dependencies, 4.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found