-
Notifications
You must be signed in to change notification settings - Fork 287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Include non ts file (like json) #548
Comments
I don't think it would be a good practice to include files that in some types of applications, need to be read at different times. For example, an application that reads a particular file, then makes an edit and saves it again. It would be confusing to specify files that should or should not be included in the final .js file, unless ncc wants to stop being a simple CLI in the future as it says. |
In my example, those JSON files are config files and translations files. At the moment I don't have a solution in mind because I cannot modify the framework and I'm not allowed by NCC to include them in the build process. Do you have any suggestions? Those files would be read-only. |
When the files are referenced somewhere in your code, e.g. fs.readFileSync(__dirname + 'path/to/your.json') The underlying webpack-asset-relocator-loader should be able to find it & add it into the bundle. |
If want to read a specific path, that should not be modified by ncc, you can use const translations = __non_webpack_require__('static/path/not/altered/by/ncc/translations.json') But keep in mind that |
Hi @ofhouse the problem is that those files are not directly required in that way by the framework. They're going to load all those files automatically from a specific path. So there's no way to bundle them if the framework does not change how it works? |
@StErMi Is the framework public available so that you can post a link? ncc covers a lot of cases but after all it's all based on static code analyzing so there is always a chance that something is missed by the algorithm. Then we can find out whether it is something that could be covered by static code analyzing from ncc or if changes to the framework are needed. |
Hate to dig up an old topic, but I also ran into this recently when upgrading one of my projects from JavaScript to TypeScript. The JavaScript version had copied some .sh and .ps1 scripts into the bundle, but the TypeScript version no longer does. [Edit] |
Hi all,
the underlying framework that I'm using assumes that I have some JSON and TS file in a specific path.
Would it be possible to force include some files or some files in a specific platform in the final build?
The text was updated successfully, but these errors were encountered: