| 53 | }; |
| 54 | |
| 55 | function create(entries, tsConfig, outDir = ".") { |
| 56 | const resolvedEntries = Object.fromEntries(Object.entries(entries).map(([k, v]) => [k, path.resolve(__dirname, v)])); |
| 57 | return { |
| 58 | context: __dirname, |
| 59 | entry: resolvedEntries, |
| 60 | mode: "development", |
| 61 | devtool: "inline-source-map", |
| 62 | target: "web", |
| 63 | plugins: [ |
| 64 | new TsCheckerRspackPlugin({ |
| 65 | async: true, |
| 66 | devServer: true, |
| 67 | typescript: { |
| 68 | build: true, |
| 69 | configFile: path.resolve(tsConfig), |
| 70 | } |
| 71 | }) |
| 72 | ], |
| 73 | optimization: { |
| 74 | removeAvailableModules: false, |
| 75 | removeEmptyChunks: false, |
| 76 | splitChunks: false, |
| 77 | }, |
| 78 | infrastructureLogging: { level: "log" }, |
| 79 | ignoreWarnings: [/export .* was not found in/], |
| 80 | |
| 81 | resolve: { |
| 82 | conditionNames: [ 'tiny:source', '...' ], |
| 83 | extensions: [".ts", ".js"], |
| 84 | tsConfig: { |
| 85 | configFile: path.resolve(tsConfig), |
| 86 | references: "auto", |
| 87 | }, |
| 88 | }, |
| 89 | watchOptions: { |
| 90 | ignored: ["**/node_modules/**"] |
| 91 | }, |
| 92 | module: { |
| 93 | rules: [ |
| 94 | { |
| 95 | test: /\.js$/, |
| 96 | resolve: { fullySpecified: false }, |
| 97 | }, |
| 98 | { test: /\.(js|mjs)$/, use: ["source-map-loader"], enforce: "pre" }, |
| 99 | { test: /\.svg$/i, type: "asset/source" }, |
| 100 | { resourceQuery: /raw/, type: "asset/source" }, |
| 101 | { |
| 102 | test: /\.ts$/, |
| 103 | use: [ |
| 104 | { |
| 105 | loader: "string-replace-loader", |
| 106 | options: { |
| 107 | test: /EditorManager.ts/, |
| 108 | multiple: [ |
| 109 | { |
| 110 | search: "@@majorVersion@@", |
| 111 | replace: packageData.version.split(".")[0], |
| 112 | }, |