Skip to content

Commit ac96525

Browse files
🔧 chore(core): Update TypeScript and Webpack configurations
- Changed the `rootDir` in `tsconfig.json` from `.` to `./src` to better reflect the project structure. - Excluded `examples/**/*` from the TypeScript compilation to streamline the build process. - Enhanced the Webpack configuration by specifying `ts-loader` options for better TypeScript handling and ensuring it respects the `tsconfig.json` paths. - Updated the Webpack `resolve` configuration to include the project root for module resolution. - Added a `clean` option to the Webpack output configuration to clear the `dist` folder before each build. These changes aim to improve the build process and ensure better integration between TypeScript and Webpack.
1 parent 55e6133 commit ac96525

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

packages/core/tsconfig.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"skipLibCheck": true,
1212
"forceConsistentCasingInFileNames": true,
1313
"outDir": "./dist",
14-
"rootDir": ".",
14+
"rootDir": "./src",
1515
"declaration": true,
1616
"resolveJsonModule": true,
1717
"moduleResolution": "node",
@@ -26,11 +26,11 @@
2626
},
2727
"include": [
2828
"src/**/*",
29-
"examples/**/*"
3029
],
3130
"exclude": [
3231
"node_modules",
3332
"dist",
34-
"**/*.test.ts"
33+
"**/*.test.ts",
34+
"examples/**/*"
3535
]
3636
}

packages/core/webpack.config.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,28 @@ module.exports = {
1111
rules: [
1212
{
1313
test: /\.tsx?$/,
14-
use: 'ts-loader',
14+
use: {
15+
loader: 'ts-loader',
16+
options: {
17+
configFile: path.resolve(__dirname, 'tsconfig.json'),
18+
// Ensure webpack respects tsconfig paths
19+
transpileOnly: false
20+
}
21+
},
1522
exclude: [/node_modules/, /examples/, /logs/],
1623
},
1724
],
1825
},
1926
resolve: {
2027
extensions: ['.tsx', '.ts', '.js'],
28+
// Ensure webpack resolves from the project root
29+
modules: [path.resolve(__dirname, 'src'), 'node_modules'],
2130
},
2231
output: {
2332
filename: '[name].js',
2433
path: path.resolve(__dirname, 'dist'),
2534
libraryTarget: 'commonjs2',
35+
clean: true, // Add this to clean the dist folder before each build
2636
},
2737
externals: {
2838
fastify: 'fastify',

0 commit comments

Comments
 (0)