Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export default defineConfig(
},
server: {
// server settings
tsconfigFileName: 'custom-tsconfig.json',
},
};
},
Expand Down Expand Up @@ -143,6 +144,8 @@ All server settings are used only in dev mode:
- `watchThrottle` (`number`) — use to add an extra throttle, or delay restarting.
- `inspect/inspectBrk` (`number | true`) — listen for a debugging client on specified port.
If specified `true`, try to listen on `9229`.
- `tsconfig` (`string`) — name of the tsconfig file for server build.
Default: `tsconfig.json`.

### Client

Expand Down
8 changes: 7 additions & 1 deletion src/commands/build/build-service/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export function buildServer(config: NormalizedServiceConfig): Promise<void> {
createRunFolder();

return new Promise((resolve, reject) => {
const tsconfigFileName = config.server.tsconfigFileName || 'tsconfig.json';

const build = new ControllableScript(
`
let ts;
Expand All @@ -27,7 +29,11 @@ export function buildServer(config: NormalizedServiceConfig): Promise<void> {
)});

const logger = new Logger('server', ${config.verbose});
compile(ts, {logger, projectPath: ${JSON.stringify(paths.appServer)}});
compile(ts, {
logger,
projectPath: ${JSON.stringify(paths.appServer)},
configFileName: ${JSON.stringify(tsconfigFileName)}
});
`,
null,
);
Expand Down
5 changes: 4 additions & 1 deletion src/commands/dev/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ export async function watchServerCompilation(config: NormalizedServiceConfig) {

createRunFolder();

const tsconfigFileName = config.server.tsconfigFileName || 'tsconfig.json';

const build = new ControllableScript(
`
let ts;
Expand All @@ -38,7 +40,8 @@ export async function watchServerCompilation(config: NormalizedServiceConfig) {
onAfterFilesEmitted: () => {
process.send({type: 'Emitted'});
},
enableSourceMap: true
enableSourceMap: true,
tsconfigFileName: ${JSON.stringify(tsconfigFileName)}
}
);
`,
Expand Down
5 changes: 5 additions & 0 deletions src/common/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ export interface ServerConfig {
watchThrottle?: number;
inspect?: number | true;
inspectBrk?: number | true;
/**
* Name of the tsconfig file for server build
* Default: 'tsconfig.json'
*/
tsconfigFileName?: string;
}
export interface ServiceConfig {
target?: 'client' | 'server';
Expand Down
10 changes: 8 additions & 2 deletions src/common/typescript/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,17 @@ export function watch(
logger,
onAfterFilesEmitted,
enableSourceMap,
}: {logger: Logger; onAfterFilesEmitted?: () => void; enableSourceMap?: boolean},
tsconfigFileName,
}: {
logger: Logger;
onAfterFilesEmitted?: () => void;
enableSourceMap?: boolean;
tsconfigFileName: string;
},
) {
logger.message('Start compilation in watch mode');
logger.message(`Typescript v${ts.version}`);
const configPath = getTsProjectConfigPath(ts, projectPath);
const configPath = getTsProjectConfigPath(ts, projectPath, tsconfigFileName);

const createProgram = ts.createEmitAndSemanticDiagnosticsBuilderProgram;

Expand Down
Loading