openwhisk-composer icon indicating copy to clipboard operation
openwhisk-composer copied to clipboard

with webpack bundle optimization, Composer.compile fails

Open starpit opened this issue 5 years ago • 1 comments

the terser webpack bundle optimizer by default renames javascript classes. as a result, composer.compile fails with

Invalid argument "task" in "task" combinator
Argument value: m {
  '.combinator': [Function: .combinator],
  type: 'action',
  name: '/_/authenticate',
  path: '.test'
}

for now, a workaround is to set keep_classnames: true in the terserOptions passed to the terser webpack plugin constructor.

starpit avatar Jan 29 '20 02:01 starpit

some extra info: the task interpretation expects these two to yield the same value:

> task.constructor.name
"m"
> Composition.name
"Composition"

i suspect that this is testable outside of webpack, by using the terser npm directly; i think composer already uses it, for the conductor code. so a test would be to apply it to the composer code, as well, and verify that the tests still pass?

starpit avatar Jan 29 '20 02:01 starpit