Unable to set property as extern when compiling in ADVANCED level
See original GitHub issueHi guys,
First of all, I’m new to closure-compiler, so please bear with me.
I’m unable to get my web worker
module (below snippet) to work with closure-compiler
when using the ADVANCED
level.
$ closure-compiler --compilation_level ADVANCED --js trock.js
var tRock;
self.addEventListener('message', (ev) => {
/** @const */
const msg = ev.data;
switch(msg.tag) {
case 'upload':
tRock = msg.ep.tRock; // <------- error happens here after it's compiled
[...]
break;
default:
//console.error("unexpected msg from main thread", msg);
self.close();
}
});
When the compiler runs, it changes this:
switch(msg.tag) {
case 'upload':
tRock = msg.ep.tRock
to:
switch(a) {
case 'upload':
k=a.a.g
How i can prevent renaming msg.ep
?
I tried to put /** @const */
, but it had no impact.
As this is a web worker
, the ev message is received from elsewhere and the compiler should not rename its properties.
I was expecting the following correct output:
switch(a.tag) {
case 'upload':
k=a.ep.tRock
Help appreciated. Thanks
Issue Analytics
- State:
- Created 3 years ago
- Comments:16 (9 by maintainers)
Top Results From Across the Web
What is an undefined reference/unresolved external symbol ...
I just came across another possible reason for the unresolved symbol compiler error. A function was originally defined as inline inside a header,...
Read more >Linker Tools Error LNK2019 - Microsoft Learn
If the error message is similar to unresolved external symbol WinMain referenced in function function_name, link by using /SUBSYSTEM:CONSOLE ...
Read more >Top 10 C++ header file mistakes and how to fix them
Recommendation: Check your header filies by compiling them in isolation via a testMain.cpp that includes nothing but the header file under test.
Read more >Advanced Compilation | Closure Compiler - Google Developers
The solution in this situation is to implement a set of externs defining the public API of your library. Your code will supply...
Read more >Understanding "extern" keyword in C - GeeksforGeeks
This program throws an error in the compilation(during the linking phase, more info here) because var is declared but not defined anywhere.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think we’re missing the extern for
replaceAll
- I don’t see it anywhere ines[356].js
.@brad4d thank you very much. With your advices and nice tutorial, we are now able to fully benefit from
closure-compiler
avanced level in a much larger project involvingWebWorkers
.