vue-cli-plugin-ts-bundler

Zero configuration bundler for your TypeScript library

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
vue-cli-plugin-ts-bundler
310.0.34 years ago4 years agoMinified + gzip package size for vue-cli-plugin-ts-bundler in KB

Readme

:rocket: vue-cli-plugin-ts-bundler
Zero configuration bundler for your TypeScript library

Use case

You create a library component that is compiled in a signle js file, and you want to left the support of TypeScript.
The plugin allows to generate a single dts file to share your code as external module.

Features

The plugin is basically a wrapper of dts-bundle. All dts-bundle features are available when using the command.
And additionally:
  • generate the minimum configuration to build TypeScript library
  • removes all conflicts with dts generating

Getting Started

A new project

If yon don't have a project, you can create it using the preset:
vue create --preset vatson/vue-ts-lib my-vue-lib

More information you can find here https://github.com/vatson/vue-ts-lib

Adding to an existing project

Install the plugin into your project:
cd my-vue-app
vue add ts-bundler

Now you can run build or use CLI commands listed below.

CLI Commands

The plugin adds one command bundle-dts to bundle the declaration files generated during build process.
npx vue-cli-service bundle-dts [options]

or already configured npm command
npm run bundleDts

All supported options you can find here https://github.com/TypeStrong/dts-bundle

Example of use


Feel free to create an issue if you want to add your project to the list and help others solve their problems on good examples

Known caveats

In order for everything to work correctly, there was a need to disable some webpack's loaders:
  • thread-loader - doesn't allow to write dts files on filesystem;
  • cache-loader - incorrectly caches compilerOptions passed to ts-loader

Potentially useful

TODO

  • Add an ability to replace default HelloWorld with a base component;

License

MIT