2

On my page, I want to use i18next and Vue.js to display translated text. For that, I want to use YAML files for better maintainability. Here on Stackoverflow, I found this old question, where @steve-hynding posted a way to configure webpack to pre-compile the YAML files into JSON. However, the syntax he used (with the rule array) doesn't work in my case, because we're using chainWebpack. I tried to rewrite the rule, but it doesn't do anything at all.

  chainWebpack: config => {
    config.module
      .rule('yaml')
      .test(/.\.yaml$/)
      .use('file-loader')
      .loader('file-loader')
      .options({
        name: '[path][name].json',
        context: 'src'
      })
      .end()
      .use('yaml-loader')
      .loader('yaml-loader')
      .end();
  }

How can I make webpack extract the *.yaml files from a specified folder, compile it into JSON and put it into a specified folder in the public dir?

Anthon
  • 69,918
  • 32
  • 186
  • 246
André Reichelt
  • 1,484
  • 18
  • 52
  • 1
    "Can you tell me ...." is almost always the start of an inappropriate question. The valid answers would be "Yes, someone can tell you" and "No, nobody can tell you" neither of which answers is directly going to help you solve your issue. Ask direct questions about *how to do something* (yourself) not about the people that might know how to do something (or worse asking about their existence: Does anyone know....), . – Anthon May 27 '19 at 15:18

0 Answers0