Skip to content

Commit

Permalink
Made babel-preset-typescript-vue optional
Browse files Browse the repository at this point in the history
  • Loading branch information
gopeter committed Apr 20, 2020
1 parent d2443d3 commit 192d8d0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions docs/typescript.md
Expand Up @@ -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`
Expand All @@ -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

Expand All @@ -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 }]
Expand Down
2 changes: 1 addition & 1 deletion lib/install/typescript.rb
Expand Up @@ -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

0 comments on commit 192d8d0

Please sign in to comment.