[英]Where to place tsconfig.json in Symfony Encore to define TypeScript config?
Symfony Encore now supports using TypeScript by default ( Add support to enableTypescriptLoader ), and it works great. Symfony Encore现在默认支持使用TypeScript( 添加对enableTypescriptLoader的支持 ),并且效果很好。 However, I would like to configure my TypeScript configuration using a tsconfig.json file.
但是,我想使用tsconfig.json文件配置TypeScript配置。
I tried figuring out where to place this, but I got lost in the rabbithole and didn't figure out where I should place the file for ts-loader to pick it up. 我试图弄清楚该放在哪里,但迷路了,没有弄清楚应该将文件放置在哪里供ts-loader拾取。 Or if there is a configuration that enables this.
或者是否有启用此功能的配置。
Having the tsconfig.json
in same place of webpack.config.js
should do the job. 具有
tsconfig.json
在同一个地方的webpack.config.js
应该做的工作。
ts-loader
assumes the same as default configuration. ts-loader
假定与默认配置相同。
Check ts-loader configuration documentation, there is one option for configuring file name in case it is located somewhere else. 查看ts-loader配置文档,如果文件名位于其他位置,则有一个配置文件名的选项。
UPDATE: Keep an eye on this docs there is some documentation on the way. 更新:密切关注此文档 ,途中有一些文档 。
Configuration goes like: 配置如下:
.enableTypeScriptLoader(function (typeScriptConfigOptions) {
typeScriptConfigOptions.transpileOnly = true;
typeScriptConfigOptions.configFileName = '/path/to/tsconfig.json';
});
But again, loader defaults for configFileName
option is: tsconfig.json
so, should be enough having the file in same directory of webpack.config.js
or in same directory from where you run webpack, not sure now actually. 但同样,loader的
configFileName
选项默认为: tsconfig.json
因此,将文件放在webpack.config.js
同一目录中或运行webpack的目录中应该足够了,现在不确定。 I always run webpack from same dir as webpack.config.js
:) 我总是从与webpack.config.js相同的目录运行
webpack.config.js
:)
Cheers 干杯
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.