簡體   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