Version 2.0.0
introduces breaking changes due to structural improvements and Webpack support. Follow these steps to ensure a smooth upgrade.
Install the latest version of ts-runtime-picker
:
npm install [email protected]
The import name for the Vite plugin has changed:
- Before:
import tsRuntimePicker from "ts-runtime-picker/vite-plugin";
- Now:
Update your
import TsRuntimePickerVitePlugin from "ts-runtime-picker/vite-plugin";
vite.config.ts
to reflect the new import name:import { defineConfig } from "vite"; import TsRuntimePickerVitePlugin from "ts-runtime-picker/vite-plugin"; export default defineConfig({ plugins: [TsRuntimePickerVitePlugin()], });
For projects using Webpack, you can now integrate ts-runtime-picker
using its custom loader.
-
Update Webpack Configuration: Add the following rule to your
webpack.config.js
:{ test: /\.ts$/, use: [ { loader: 'ts-loader', }, { loader: 'ts-runtime-picker/webpack-loader', // ts-runtime-picker loader }, ], }
-
Ensure the Order of Loaders: The
ts-runtime-picker/webpack-loader
must come afterts-loader
to work correctly.
After upgrading, rebuild your project and verify that:
- Your Vite or Webpack configurations are correctly updated.
- Your
createPicker
calls are being transformed as expected.
-
Vite Plugin Errors:
- Ensure you’ve updated the import to
TsRuntimePickerVitePlugin
.
- Ensure you’ve updated the import to
-
Webpack Loader Issues:
- Ensure the loader is placed after
ts-loader
in your Webpack rules. - Verify that your TypeScript files are correctly matched by the
test
condition.
- Ensure the loader is placed after
By following these steps, your project will be fully compatible with the new version of ts-runtime-picker
. 🚀 Let us know if you encounter any issues!