# 04 · rootdir-sourcemap **演示**:`rootDir: "src"` 让产物直接落在 `dist/`;省略它会报 `TS5011`。`sourceMap` 生成可调试映射。 **运行**:在 `tutorials/typescript` 下执行 `npm run build`,再执行 `npm run serve`,打开 `http://localhost:8080/examples/31-tsconfig-build-pipeline/04-rootdir-sourcemap/`;开 Console。 **预期控制台输出**: ```text ok ``` **类型检查**:`node node_modules/typescript/bin/tsc -p examples/31-tsconfig-build-pipeline/04-rootdir-sourcemap/tsconfig.types.json` **预期类型错误**(`tsconfig.fail-noroot.json` 触发): ```text tsconfig.fail-noroot.json(4,5): error TS5011: The common source directory of 'tsconfig.fail-noroot.json' is './src'. The 'rootDir' setting must be explicitly set to this or another path to adjust your output's file layout. ``` **注意**:TS 7 的 `rootDir` 默认是 `./`,不写会得到 `dist/src/main.js` 这种多一层目录。