Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to emit TS declaration files when build target is Library #6543

Open
Robula opened this issue Jun 23, 2021 · 2 comments
Open

Option to emit TS declaration files when build target is Library #6543

Robula opened this issue Jun 23, 2021 · 2 comments

Comments

@Robula
Copy link

Robula commented Jun 23, 2021

What problem does this feature solve?

Whilst we can build component libraries using --target lib, if these components are built and consumed in Typescript projects they are missing their types.

A workaround is to modify the webpack configuration but I'm sure this is a common use case to warrant this being either the default behavior or at the very least having an option to enable it.

chainWebpack: config => {
    config.module
      .rule('ts')
      .uses
      .delete('thread-loader')

    config.module
      .rule('ts')
      .use('ts-loader')
      .tap(options => {
        options.transpileOnly = false
        options.happyPackMode = false
        options.compilerOptions = {
          declaration: true,
          noEmit: false,
          outDir: 'lib'
        }
        return options
      })
}

What does the proposed API look like?

N/A

@Robula
Copy link
Author

Robula commented Jun 24, 2021

Seems like this duplicates #1081 however I am on 4.5.13, not v3.

@mater1996
Copy link

use vue-dts-gen ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants