简体   繁体   English

如何访问位于 webpack.config.js angular 8 的应用程序中的文件夹内(不在 js 文件夹中)的文本文件

[英]How to access the text file located inside a foler (not in js folder) in webpack.config.js angular 8 based application

I am trying to access a text file(license key file) in my angular 8 application which is located under wwwroot folder but it should not be in js folder.我正在尝试访问位于 wwwroot 文件夹下的 angular 8 应用程序中的文本文件(许可证密钥文件),但它不应位于 js 文件夹中。 if anybody has idea how to configure this through web.config.js/tsconfig.js or any other file change.如果有人知道如何通过 web.config.js/tsconfig.js 或任何其他文件更改来配置它。 (note: my application is using webpack.config.js file not the angular.json file) (注意:我的应用程序使用的是 webpack.config.js 文件而不是 angular.json 文件)

Your help will be a great appreciation for me.您的帮助将是对我的极大感激。

thanks谢谢

You can just import it你可以只导入它

import { license } from './license';

consider putting your data to environment folder.考虑将您的数据放入环境文件夹。 Otherwise you can use http call.否则可以使用 http 调用。

See this for more info.有关更多信息,请参阅内容。

I have done it by change in configure method in startup.cs file and adding my folder.我通过更改 startup.cs 文件中的配置方法并添加我的文件夹来完成它。 It worked like a charm.它就像一个魅力。 Thanks guys for your great help谢谢你们的大力帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM