google / google/closure-compiler
Add option to disable string array literal peephole optimization
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
This was initially posted [to mailing list](https://groups.google.com/forum/#!topic/closure-compiler-discuss/NAJEIwckYeE), but no one replied, so here is the feature request.
I have AMD module with following line:
```javascript
define(['@detox/crypto', '@detox/dht', '@detox/utils', 'ronion', 'fixed-size-multiplexer', 'async-eventer', 'pako'], Wrapper)
```
The issue is that starting with 6th depedency Closure Compiler in advanced mode decides that it is a good idea to replace that array with splitted string like this:
```javascript
define("@detox/crypto @detox/dht @detox/utils ronion fixed-size-multiplexer async-eventer pako".split(" "),A)
```
Which makes sense in general, but fails when I try to use minified result with https://github.com/requirejs/r.js, which doesn't understand such construction and requires explicit array of dependencies.
It would be very useful to have an option to disable this particular optimization in advanced mode.
Contributor guide
Assessment
This issue has not been assessed yet.