Vue-cli: Option to specify custom tsconfig.json

Created on 1 Sep 2018  路  4Comments  路  Source: vuejs/vue-cli

What problem does this feature solve?

Would be nice to have ability to specify custom tsconfig.json. For example, we have two different tsconfig files: backend.tsconfig.json and frontend.tsconfig.json files and we need to tell vue-cli-service to use frontend.tsconfig.json

What does the proposed API look like?

tsconfig: 'frontend.tsconfig.json' - in vue.config.js

Most helpful comment

For those who might be interested as I was, you have to create a vue.config.js file at the root of your project to set the path of your tsconfig file (tsconfig.app.json in my case) in the fork-ts-checker Webpack plugin:

module.exports = {
  chainWebpack: config => {
    config
      .plugin('fork-ts-checker')
      .tap(args => {
        args[0].tsconfig = './tsconfig.app.json';
        return args;
      });
  }
};

All 4 comments

You can use the chainWebpack option to adjust the config for ts-loader ans fork-ts-checker-plugin accordingly.

Example code would be nice though...

We have a very active forum and chat for support.

Issues are not meant for that, as explained in the isssue guidelines.

For those who might be interested as I was, you have to create a vue.config.js file at the root of your project to set the path of your tsconfig file (tsconfig.app.json in my case) in the fork-ts-checker Webpack plugin:

module.exports = {
  chainWebpack: config => {
    config
      .plugin('fork-ts-checker')
      .tap(args => {
        args[0].tsconfig = './tsconfig.app.json';
        return args;
      });
  }
};
Was this page helpful?
0 / 5 - 0 ratings