-
Notifications
You must be signed in to change notification settings - Fork 19
Error: Illegal #include (Preprocessor.js:225) #10
Comments
My bad. The error was shown due to my slow typing/quick reaction of a script that runs the preprocessor. |
Maybe I miss something, but for a main.js with contents // #include "test.js"
console.log('testing include');
// #include "test.js" the file test.js is of course included twice, while for // #include_once "test.js"
console.log('testing include');
// #include_once "test.js" it's not. |
Ah, again my bad for not specifically describing the problem. |
I see. Well, the issue here is that #define is quite a hack currently and does not play well with #ifdef, which is of course bad and I'd need to invest some time to rethink both. Personally, I am migrating all my projects to MetaScript currently (e.g. https://github.com/dcodeIO/ByteBuffer.js/tree/master/src), which is a more javascripty way of preprocessing, and I'd recommend that you'd do the same. test.js //? if (typeof TEST === 'undefined') { TEST = true;
console.log("test");
//? } main.js //? include("test.js");
console.log('testing include');
//? include("test.js"); which does exactly what you need. |
Thanks for the tip. |
Result:
The file test.js is included twice in the output file.
The following error is shown:
Expected result:
The file test.js is included only once in the output file.
No errors are shown.
P. S. I see that there's an undocumented directive #include_once for such cases. But still this is an error.
The text was updated successfully, but these errors were encountered: