Chore: Replace ts-loader in e2e and input-datasource (#76872)

* build(npm): remove ts-loader from core and input-datasource

* build(input-datasource): update webpack config to use swc-loader

* chore(e2e): replace ts-loader with esbuild-loader
This commit is contained in:
Jack Westbrook 2023-10-23 10:45:22 +02:00 committed by GitHub
parent 580a4cac58
commit 964c011822
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 24 additions and 42 deletions

View File

@ -1,32 +1,18 @@
const wp = require('@cypress/webpack-preprocessor');
const { resolve } = require('path');
const anyNodeModules = /node_modules/;
const packageRoot = resolve(`${__dirname}/../../`);
const packageModules = `${packageRoot}/node_modules`;
const webpackOptions = {
module: {
rules: [
{
include: (modulePath) => {
if (!anyNodeModules.test(modulePath)) {
// Is a file within the project
return true;
} else {
// Is a file within this package
return modulePath.startsWith(packageRoot) && !modulePath.startsWith(packageModules);
}
},
test: /\.ts$/,
use: [
{
loader: 'ts-loader',
options: {
transpileOnly: true,
},
exclude: /node_modules/,
use: {
loader: 'esbuild-loader',
options: {
target: 'es2020',
format: undefined,
},
],
},
},
],
},

View File

@ -226,7 +226,6 @@
"testing-library-selector": "0.3.1",
"tracelib": "1.0.1",
"ts-jest": "29.1.1",
"ts-loader": "9.3.1",
"ts-node": "10.9.1",
"typescript": "4.8.4",
"wait-on": "7.0.1",

View File

@ -22,8 +22,8 @@
"fork-ts-checker-webpack-plugin": "8.0.0",
"jest": "29.3.1",
"jest-environment-jsdom": "29.3.1",
"swc-loader": "0.2.3",
"ts-jest": "29.0.5",
"ts-loader": "9.3.1",
"ts-node": "10.9.1",
"webpack": "5.76.0"
},

View File

@ -70,7 +70,20 @@ const config = async (env: Record<string, string>): Promise<Configuration> => ({
exclude: /(node_modules)/,
test: /\.[tj]sx?$/,
use: {
loader: 'ts-loader',
loader: 'swc-loader',
options: {
jsc: {
baseUrl: '.',
target: 'es2015',
loose: false,
parser: {
syntax: 'typescript',
tsx: true,
decorators: false,
dynamicImport: true,
},
},
},
},
},
{

View File

@ -2881,8 +2881,8 @@ __metadata:
jest: 29.3.1
jest-environment-jsdom: 29.3.1
react: 18.2.0
swc-loader: 0.2.3
ts-jest: 29.0.5
ts-loader: 9.3.1
ts-node: 10.9.1
tslib: 2.5.0
webpack: 5.76.0
@ -15240,7 +15240,7 @@ __metadata:
languageName: node
linkType: hard
"enhanced-resolve@npm:^5.0.0, enhanced-resolve@npm:^5.10.0, enhanced-resolve@npm:^5.15.0":
"enhanced-resolve@npm:^5.10.0, enhanced-resolve@npm:^5.15.0":
version: 5.15.0
resolution: "enhanced-resolve@npm:5.15.0"
dependencies:
@ -18084,7 +18084,6 @@ __metadata:
tinycolor2: 1.6.0
tracelib: 1.0.1
ts-jest: 29.1.1
ts-loader: 9.3.1
ts-node: 10.9.1
tslib: 2.6.0
tween-functions: ^1.2.0
@ -29048,21 +29047,6 @@ __metadata:
languageName: node
linkType: hard
"ts-loader@npm:9.3.1":
version: 9.3.1
resolution: "ts-loader@npm:9.3.1"
dependencies:
chalk: ^4.1.0
enhanced-resolve: ^5.0.0
micromatch: ^4.0.0
semver: ^7.3.4
peerDependencies:
typescript: "*"
webpack: ^5.0.0
checksum: 462a8ac315017cf4961dafd2be29d5abe7c3af63c4515e325269f79b9d0212b35c59184d7fd01fc378749c88454752e1599301d2190eb6844ea5fe332de5f695
languageName: node
linkType: hard
"ts-node@npm:10.9.1, ts-node@npm:^10.2.1":
version: 10.9.1
resolution: "ts-node@npm:10.9.1"