简体   繁体   中英

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();

We need to set options in enableVueLoader

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

With Webpack 4, you need to use this syntax:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM