繁体   English   中英

如何在@symfony/webpack-encore 上加载 vue-i18n-loader

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

我在带有 webpack 的 symfony 4 应用程序上使用 Vue,并且 vue-18n 工作正常。 但我想把翻译放在每个文件组件上

我的问题是加载 de 是加载我尝试加载的vue-i18n-loader有多种方式......有人这样做过吗? 谢谢

我的 webpack 文件:

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

我们需要在enableVueLoader设置选项

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

对于 Webpack 4,您需要使用以下语法:

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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