Просмотр исходного кода

Use resolve.tsconfig (#31639)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
GitOrigin-RevId: 1c7da49e14af5935f85f1927186a825b116bb4e9
Alf Eaton 2 месяцев назад
Родитель
Сommit
30edd837e1
2 измененных файлов с 15 добавлено и 22 удалено
  1. 14 14
      services/web/tsconfig.json
  2. 1 8
      services/web/webpack.config.js

+ 14 - 14
services/web/tsconfig.json

@@ -1,26 +1,26 @@
 {
   "compilerOptions": {
-    "target": "esnext" /* Specify ECMAScript target version */,
-    "module": "esnext" /* Specify module code generation */,
-    "allowJs": true /* Allow JavaScript files to be compiled. */,
+    "target": "esnext",
+    "module": "esnext",
+    "allowJs": true,
     "resolveJsonModule": true,
-    //    "checkJs": true /* Report errors in .js files. */,
-    "jsx": "preserve" /* Specify JSX code generation */,
-    "noEmit": true /* Do not emit outputs. */,
-    "strict": true /* Enable all strict type-checking options. */,
-    "moduleResolution": "bundler" /* Specify module resolution strategy */,
+    "jsx": "preserve",
+    "noEmit": true,
+    "strict": true,
+    "moduleResolution": "bundler",
     "isolatedModules": true,
-    "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
-    "skipLibCheck": true /* Skip type checking of declaration files. */,
-    "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
-    "experimentalDecorators": true /* Allow decorators in writefull - inversify */,
-    "emitDecoratorMetadata": true /* Allow decorators in writefull - inversify */,
+    "esModuleInterop": true,
+    "skipLibCheck": true,
+    "forceConsistentCasingInFileNames": true,
+    "experimentalDecorators": true,
+    "emitDecoratorMetadata": true,
+    "baseUrl": ".",
     "paths": {
       "@/*": ["./frontend/js/*"],
       "@modules/*": ["./modules/*"],
       "@overleaf/o-error": ["../../libraries/o-error"],
       "@overleaf/ranges-tracker": ["../../libraries/ranges-tracker"],
-      /* can't make this entry @types because that conflicts with the "types" entry below */
+
       "@ol-types/*": ["./types/*"],
       "@ol-storybook/*": ["./.storybook/*"],
       "@wf/*": ["./modules/writefull/frontend/js/integration/src/*"],

+ 1 - 8
services/web/webpack.config.js

@@ -307,15 +307,8 @@ module.exports = {
     ],
   },
   resolve: {
+    tsconfig: path.resolve(__dirname, 'tsconfig.json'),
     alias: {
-      // custom prefixes for import paths
-      '@': path.resolve(__dirname, './frontend/js/'),
-      '@modules': path.resolve(__dirname, './modules/'),
-      '@ol-types': path.resolve(__dirname, './types/'),
-      '@wf': path.resolve(
-        __dirname,
-        './modules/writefull/frontend/js/integration/src/'
-      ),
       // Ensure all packages use the same jQuery instance (prevents duplicate
       // copies from Yarn hoisting breaking jQuery plugins like daterangepicker)
       jquery: require.resolve('jquery'),