From 7755023b6ff59c8a74ba04471711480749416e7a Mon Sep 17 00:00:00 2001 From: Peter Oesteritz Date: Sun, 19 Apr 2020 20:44:34 +0200 Subject: [PATCH] Switch from ts-loader to babel-loader (#2449) --- docs/testing.md | 3 +-- docs/typescript.md | 24 ++++--------------- lib/install/examples/react/tsconfig.json | 3 ++- lib/install/examples/typescript/tsconfig.json | 3 ++- lib/install/loaders/typescript.js | 11 --------- lib/install/typescript.rb | 20 +++++++--------- lib/webpacker/compiler.rb | 5 ++-- package/rules/babel.js | 2 +- 8 files changed, 20 insertions(+), 51 deletions(-) delete mode 100644 lib/install/loaders/typescript.js diff --git a/docs/testing.md b/docs/testing.md index 49b6db97e..e77984050 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -10,8 +10,7 @@ Webpacker does not setup `Karma` by default, so you've to manually install it al "test": "NODE_ENV=test karma start" }, "dependencies": { - "typescript": "^2.5.2", - "ts-loader": "^2.3.7" + "typescript": "^2.5.2" }, "devDependencies": { "karma": "^1.7.1", diff --git a/docs/typescript.md b/docs/typescript.md index 04769c50f..9eda231ab 100644 --- a/docs/typescript.md +++ b/docs/typescript.md @@ -21,35 +21,19 @@ bundle exec rails webpacker:install:typescript ``` 2. Rename generated `hello_vue.js` to `hello_vue.ts`. -3. Add the webpack plug-n-play plugin to your yarn packages with `yarn add pnp-webpack-plugin`. -4. Change the generated `config/webpack/loaders/typescript.js` from +3. Change the generated `babel.config.js` from ```js -module.exports = { - test: /\.tsx?(\.erb)?$/, - use: [{ - loader: 'ts-loader' - }] -} +["@babel/preset-typescript", { "allExtensions": true, "isTSX": true }] ``` to ```js -const PnpWebpackPlugin = require('pnp-webpack-plugin'); - -module.exports = { - test: /\.tsx?(\.erb)?$/, - use: [{ - loader: 'ts-loader', - options: PnpWebpackPlugin.tsLoaderOptions({ - appendTsSuffixTo: [/\.vue$/] - }) - }] -} +["babel-preset-typescript-vue", { "allExtensions": true, "isTSX": true }] ``` -and now you can use `