2026-03-27 14:50:34 +09:00
|
|
|
import type { NextConfig } from 'next';
|
2026-03-28 08:19:48 +09:00
|
|
|
import path from 'path';
|
|
|
|
|
|
|
|
|
|
const sharedSrc = path.resolve(import.meta.dirname, '../shared/src');
|
2026-03-27 14:50:34 +09:00
|
|
|
|
|
|
|
|
const nextConfig: NextConfig = {
|
2026-03-28 08:19:48 +09:00
|
|
|
turbopack: {},
|
|
|
|
|
webpack: (config) => {
|
|
|
|
|
// The shared package source uses ESM `.js` extensions on imports (e.g. `./enums/index.js`).
|
|
|
|
|
// When Next.js resolves via tsconfig paths to the raw `.ts` source, webpack needs to
|
2026-04-26 18:44:59 +09:00
|
|
|
// know that `.js` imports inside that directory should resolve to `.ts`/`.tsx` files.
|
2026-03-28 08:19:48 +09:00
|
|
|
config.resolve = config.resolve ?? {};
|
|
|
|
|
config.resolve.extensionAlias = {
|
|
|
|
|
...config.resolve.extensionAlias,
|
2026-04-26 18:44:59 +09:00
|
|
|
'.js': ['.tsx', '.ts', '.jsx', '.js'],
|
2026-03-28 08:19:48 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Ensure the shared source directory is included in the module resolution
|
|
|
|
|
config.resolve.alias = {
|
|
|
|
|
...config.resolve.alias,
|
|
|
|
|
'@meshitrack/shared': sharedSrc,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return config;
|
|
|
|
|
},
|
2026-03-27 14:50:34 +09:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default nextConfig;
|