diff --git a/docs/typescript.md b/docs/typescript.md index 858ad4c71..4f19d8cb0 100644 --- a/docs/typescript.md +++ b/docs/typescript.md @@ -18,7 +18,7 @@ If you update your App to `webpacker >= 5.1` and had TypeScript installed before - `yarn remove ts-loader` 2. Add new packages: - - `yarn add @babel/preset-typescript babel-preset-typescript-vue -D` + - `yarn add @babel/preset-typescript` 3. Remove old configuration files: - Delete this file: `config/webpack/loaders/typescript.js` @@ -35,7 +35,7 @@ If you update your App to `webpacker >= 5.1` and had TypeScript installed before 1. Remove old packages: - `yarn remove ts-loader pnp-webpack-plugin` -2. Follow point 3 from the `TypeScript with Vue components` section +2. Follow point 3 and 4 from the `TypeScript with Vue components` section ## TypeScript with React @@ -57,7 +57,8 @@ bundle exec rails webpacker:install:typescript ``` 2. Rename generated `hello_vue.js` to `hello_vue.ts`. -3. Change the generated `babel.config.js` from +3. Install the right Babel preset: `yarn add babel-preset-typescript-vue` +4. Change the generated `babel.config.js` from ```js ["@babel/preset-typescript", { "allExtensions": true, "isTSX": true }] diff --git a/lib/install/typescript.rb b/lib/install/typescript.rb index 10e3ed483..8aa594562 100644 --- a/lib/install/typescript.rb +++ b/lib/install/typescript.rb @@ -34,6 +34,6 @@ "#{Webpacker.config.source_entry_path}/hello_typescript.ts" say "Installing all typescript dependencies" -run "yarn add typescript @babel/preset-typescript babel-preset-typescript-vue #{additional_packages}" +run "yarn add typescript @babel/preset-typescript #{additional_packages}" say "Webpacker now supports typescript 🎉", :green