使用.projenrc.js的纱线构建YARN build of typecript项目后,包装/包括文本文件或.ts文件以外
我使用projen创建了打字条项目(请参阅链接: https://github.com/projen/projen/projen )
mkdir my-project
git init
npx projen new typescript
我创建了两个文件,为 sample.txt & sample.js 和 index.ts是使用文件夹结构创建的默认文件。创建的文件夹结构是& YARN构建后的LIB文件夹结果:
如果我进行纱线构建,则只有.ts file/files在LIB文件夹下包装,但我想包括/打包 .txt& .js 文件 我必须在.projenrc.js中提及什么配置。 我在下面尝试过:
tsconfig: {
include: [
'src/*.txt',
'src/*.js',
'src/**/*.txt',
'src/**/*.js',
],
compilerOptions: {
noUnusedLocals: false, // added this so can iterate through builds without errors for variables that have not been used yet.
noUnusedParameters: false,
},
},
但是没有运气。 对此的任何帮助都非常感谢。
I created typescript project using projen (Refer Link : https://github.com/projen/projen)
mkdir my-project
git init
npx projen new typescript
I have created two files as sample.txt & sample.js, and
index.ts is a default file created with folder structure. Folder structure created is & lib folder outcome after yarn build :
If I do yarn build then only .ts file/files getting packaged under lib folder, But I want to include/packaged .txt & .js file also
what configuration I will have to mention inside .projenrc.js.
I tried below:
tsconfig: {
include: [
'src/*.txt',
'src/*.js',
'src/**/*.txt',
'src/**/*.js',
],
compilerOptions: {
noUnusedLocals: false, // added this so can iterate through builds without errors for variables that have not been used yet.
noUnusedParameters: false,
},
},
But no luck.
Any help on this really appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
单独使用TS Config,.TXT文件将不会移动。您可以将TS Config设置为允许JS:TRUE以获取JS文件捆绑。
对于.txt文件(或其他文件类型),使用脚本来复制这些文件。可能有用的东西是使用CopyFiles软件包:
copyfiles npm npm软件包
href =“ https://nx.dev/” rel =“ nofollow noreferrer“> https://nx.dev/ )提供有助于复制资产的功能,我敢肯定,其他构建系统也可以。
Using ts config alone, the .txt files will not be moved. You can set ts config with allowJs: true to get the js files bundled.
For the .txt files (or other file types) use a script to copy those files. Something that may be useful is to use copyfiles package:
copyfiles npm package
Tools like nx (https://nx.dev/) provide functionality that help with copying assets, I'm sure other build systems do as well.