Vue cli 3 - add loader

I am trying to add csv-loader to the webpack config. In the file vue.config.js I’m writting this:

module.exports = {
  chainWebpack: config => {
    config
      .module
      .rule("csv")
      .test(/\.csv$/)
      .use("csv-loader")
      .loader("csv-loader")
      .options({
        dynamicTyping: true,
        header: true,
        skipEmptyLines: true
      })
      .end();
  }
};

But it is not working, Any ideias, please? Thanks!

The config looks fine.

What’s happening?

I’m importing the file this way:
import translations from ‘./translations.csv’;

My ‘translations.csv’ is just:
url,text,pt,es
products,Product,Produto,Producto

But the content of the file is not changing to json. So I have this error:;
Uncaught ReferenceError: url is not defined

Thanks!

Sorry…! Silly error, vue.config.js was not on the root of the project…

I am also trying to include csv loader. I copied your webconfig code but I still face this error please help me resolve this issue.