:rocket: vue-cli-plugin-ts-bundlerZero configuration bundler for your TypeScript library
Use caseYou 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.
FeaturesThe plugin is basically a wrapper of dts-bundle. All dts-bundle features are available when using the command.
- generate the minimum configuration to build TypeScript library
- removes all conflicts with dts generating
A new projectIf 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 projectInstall the plugin into your project:
cd my-vue-app vue add ts-bundler
Now you can run
buildor use CLI commands listed below.
CLI CommandsThe plugin adds one command
bundle-dtsto 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 caveatsIn 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
- https://github.com/vatson/vue-cli-plugin-ts-paths helps to avoid duplication of configurations for your path aliases
- Add an ability to replace default HelloWorld with a base component;