正常的一次性构建工作正常。 但是,当使用rollup -w
,如果我在其他包之一中编辑更深层次的模块依赖项之一,rpt2 似乎无法找到源文件。
这是使用 Lerna monorepo 设置到 in-repo 依赖项的符号链接。
测试仓库: https :
我不想使用preserveSymlinks
因为在我的真实项目中,它会导致最终构建的项目中的模块重复,因为 repo 中的多个包共享公共依赖项。 我尝试了一个使用preserveSymlinks
,所以作为最后的手段,我可以配置一个使用preserveSymlinks
的开发设置,但独立/首次构建没有它,我想保留手表设置与正常构建相同。
要在上述示例存储库中重现的详细信息。
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import typescript from 'rollup-plugin-typescript2';
export default {
input: 'src/index.ts',
output: {
file: 'dist/jr-player.js',
format: 'iife',
name: 'jrPlayer',
exports: 'named'
},
watch: {
include: ['src/**', '../jr-lib/src/**', '../jr-auth/src/**']
},
plugins: [
typescript({
include: ['src/**/*.ts+(|x)', '../jr-lib/**/*.ts+(|x)', '../jr-auth/**/*.ts+(|x)'],
verbosity: 3
}),
resolve(),
commonjs()
]
};
顶级 tsconfig.json:
{
"compilerOptions": {
"moduleResolution": "node",
"module": "es2015",
"lib": [
"es2015",
"es2016",
"es2017",
"dom"
],
"strict": true,
"sourceMap": true,
"declaration": true,
"allowSyntheticDefaultImports": true,
"downlevelIteration": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noImplicitAny": false,
"esModuleInterop": true,
"removeComments": true,
"resolveJsonModule": true,
"skipLibCheck": true
}
}
packages/jr-player/tsconfig.json
:
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"target": "es5",
"declarationDir": "lib",
"outDir": "lib"
},
"include": ["."]
}
我认为它不相关,但它在测试仓库中。
已附加,但也在verbose-error.txt
测试仓库中:
可能与#188有关
另一种解决方法是使用check: false
禁用类型检查,当然这会删除大部分功能......
我有结合rollup-plugin-typescript2
和rollup-plugin-postcss
。 当我导入 _css_ 文件(例如import * as style from ./mystyle.css
)并启用 _watch_ 标志时,它给了我同样的错误。
我会尝试多调试一点,但确实check: false
解决了这个问题。