[英]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.我在带有 webpack 的 symfony 4 应用程序上使用 Vue,并且 vue-18n 工作正常。 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?我的问题是加载 de 是加载我尝试加载的vue-i18n-loader有多种方式......有人这样做过吗? Thank you
谢谢
My webpack file:我的 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();
We need to set options in enableVueLoader
我们需要在
enableVueLoader
设置选项
.enableVueLoader(function(options) {
options.loaders.i18n = '@kazupon/vue-i18n-loader'
});
With Webpack 4, you need to use this syntax:对于 Webpack 4,您需要使用以下语法:
.addRule({
resourceQuery: /blockType=i18n/,
type: 'javascript/auto',
loader: '@kazupon/vue-i18n-loader',
})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.