cmnardi
cmnardi

Reputation: 1111

How to load vue-i18n-loader on @symfony/webpack-encore

I'm using Vue on an symfony 4 application with webpack and with vue-18n working fine. But I want to put the translations on each single file component

My problem is to load de is to load the vue-i18n-loader I tried to load with may ways .... Has anyone done this? Thank you

My webpack file:

var Encore = require('@symfony/webpack-encore');
Encore
    .enableVueLoader(function(options) {
        //i tried to load here
    })
    // ...
    .addLoader({
        test: /\.styl$/,
        loader: 'style-loader!css-loader!stylus-loader'
    })
    ////i tried to load here with addLoader
;
//I tried to load here with module.exports
// export the final configuration
module.exports = Encore.getWebpackConfig();

Upvotes: 4

Views: 1203

Answers (2)

Florent Poinsaut
Florent Poinsaut

Reputation: 51

With Webpack 4, you need to use this syntax:

.addRule({
    resourceQuery: /blockType=i18n/,
    type: 'javascript/auto',
    loader: '@kazupon/vue-i18n-loader',
})

Upvotes: 2

ittus
ittus

Reputation: 22403

We need to set options in enableVueLoader

.enableVueLoader(function(options) {
   options.loaders.i18n = '@kazupon/vue-i18n-loader'
});

Upvotes: 3

Related Questions