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.

Extend vue loaders

See original GitHub issue

Is there a way to extend vue loaders? I’m trying to use vue-i18n in single file components this is what i want to achieve

// ...
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
          loaders: {
            i18n: '@kazupon/vue-i18n-loader'
          }
        }
// ...

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:10

github_iconTop GitHub Comments

1reaction
JBtjecommented, Dec 20, 2018

@lukadriel7 I’ve been keeping the vue-i18n documentations regarding laravel-mix up to date, so you can find the code in the documentations of vue-i18n: http://kazupon.github.io/vue-i18n/guide/sfc.html#laravel-mix

0reactions
lukadriel7commented, Dec 20, 2018

@JBtje Thank you very much, I had done some digging myself and came up with a solution where I simply pushed vue-i18n in the rules array like this

const mix = require('laravel-mix');

/*
 |--------------------------------------------------------------------------
 | Mix Asset Management
 |--------------------------------------------------------------------------
 |
 | Mix provides a clean, fluent API for defining some Webpack build steps
 | for your Laravel application. By default, we are compiling the Sass
 | file for the application as well as bundling up all the JS files.
 |
 */

mix.extend( 'i18n', function( webpackConfig, ...args ) {
    webpackConfig.module.rules.push(
        {
            resourceQuery: /blockType=i18n/,
            type: 'javascript/auto',
            loader: '@kazupon/vue-i18n-loader',
        }
    )
} );

mix.i18n().js('resources/js/app.js', 'public/js')
   .sass('resources/sass/app.scss', 'public/css');

But I guess it would be better to go with your solution. Thank you again

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Pre-Processors - Vue Loader - Vue.js
vue -loader allows you to use other webpack loaders to process a part of a Vue component. It will automatically infer the proper...
Read more >
vue-loader-extend - npm
Vue.js component loader for Webpack. ... This will setup a basic Webpack + vue-loader project for you, with *.vue files and hot-reloading working ......
Read more >
vue-extend-template-loader - npm package - Snyk
Based on project statistics from the GitHub repository for the npm package vue-extend-template-loader, we found that it has been starred 5 times ...
Read more >
How do I extend another VueJS component in a single-file ...
After some testing, the simple solution was to be sure to export a Vue.extend() object rather than a plain object for any component...
Read more >
Using vue-loader to create single-page applications
What is vue-loader , you ask? It's a webpack loader that supports defining Vue.js components in single files known as single-file components ( ......
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