4

我在带有 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();
4

2 回答 2

3

我们需要设置选项enableVueLoader

.enableVueLoader(function(options) {
   options.loaders.i18n = '@kazupon/vue-i18n-loader'
});
于 2018-05-15T15:28:58.510 回答
2

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

.addRule({
    resourceQuery: /blockType=i18n/,
    type: 'javascript/auto',
    loader: '@kazupon/vue-i18n-loader',
})
于 2019-11-06T13:57:49.217 回答