question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Plugin failures due to tippex dependency

See original GitHub issue

Hi! I’m afraid the recently introduced dependency on tippex (https://github.com/surma/rollup-plugin-off-main-thread/pull/32) has broken our app’s Rollup build in a few ways:

  • tippex throws an error when running on some of our third party dependencies - for example this line of code in page.js:
[!] (plugin off-main-thread) Error: Unexpected character (820:3). If this is valid JavaScript, it's probably a bug in tippex. Please raise an issue at https://github.com/Rich-Harris/tippex/issues – thanks!
  };
    ^
../../../common/temp/node_modules/.pnpm/page@1.11.6/node_modules/page/page.mjs
Error: Unexpected character (820:3). If this is valid JavaScript, it's probably a bug in tippex. Please raise an issue at https://github.com/Rich-Harris/tippex/issues – thanks!
  };
    ^
    at find (<truncated>/tippex@3.0.0/node_modules/tippex/src/index.js:318:10)
    at Object.match (<truncated>/tippex@3.0.0/node_modules/tippex/src/index.js:366:16)
    at Object.transform (<truncated>/@surma/rollup-plugin-off-main-thread@2.0.0/node_modules/@surma/rollup-plugin-off-main-thread/index.js:114:14)
    at Object.timedPlugin.<computed> (<truncated>/rollup@2.36.1/node_modules/rollup/dist/shared/rollup.js:9695:45)
    at <truncated>/rollup@2.36.1/node_modules/rollup/dist/shared/rollup.js:18781:25
  • A similar failure occurs when tippex runs on this code in URI.js.
  • Even after I manually patch the plugin’s transform function to ignore the above files, or comment out the problematic code in those files, tippex still fails in the renderChunk function, in/around some LitElement copyright headers:
Error: Unexpected character (537:5). If this is valid JavaScript, it's probably a bug in tippex. Please raise an issue at https://github.com/Rich-Harris/tippex/issues – thanks!
    }    /**
      ^
    at find (<truncated>/tippex@3.0.0/node_modules/tippex/src/index.js:318:10)
    at Object.match (<truncated>/tippex@3.0.0/node_modules/tippex/src/index.js:366:16)
    at Object.renderChunk (<truncated>/@surma/rollup-plugin-off-main-thread@2.1.0/node_modules/@surma/rollup-plugin-off-main-thread/index.js:260:14)
    at <truncated>/rollup@2.36.1/node_modules/rollup/dist/shared/rollup.js:18781:25

In all cases it seems to be failing on valid JS code.

Options to fix this

We could try to fix these apparent issues in tippex. However, given the number of issues already surfacing with it, I’m concerned that similar problems are liable to surface as our codebase grows. It’s also not clear to me that tippex is actively maintained, as it has not been modified for a few years.

For now, I wondered if you would be open to a PR that reverts to simple regex matching, instead of tippex? Long term, if a more robust approach is desired, the plugin could switch over to AST, which seems common in other rollup plugins we use. It would be more expensive, but costs could be mitigated by allowing plugin users to specify include / exclude filters.

CC @surma @RReverser

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
RReversercommented, Apr 14, 2021

@surma Can you please merge this PR and release 2.1.1 for a temporary fix?

0reactions
RReversercommented, Apr 14, 2021

but as I say I’m not sure tippex is right for this plugin

I’d say, this kind of use-cases (replacing specific patterns without doing whole-tree static analysis) is precisely the kind of cases where tippex shines over AST parsing. Considering how infrequent usage of new Worker is in real-world codebases, the savings from avoiding full AST parse can be pretty significant.

I also spoke to Rich Harris privately, and he said they’d be on outlook for any issues/repros and could look into them, so extracted examples could really help.

That said, as I already mentioned above, I agree that replacing with regular regex match-replace is okay for a temporary solution, I’m just not too happy about it as it will break on any usages with comments.

Read more comments on GitHub >

github_iconTop Results From Across the Web

There are dependency errors loading some plugins: Jenkow ...
There are dependency errors loading some plugins: Jenkow Activiti Explorer v0.3.1. jenkow-plugin v0.3.1 is missing.
Read more >
Operations center fails to load plugins or start after upgrade ...
Operations center fails to load plugins or start after upgrade with 'Failed Loading plugin', due to plugin dependency on unsupported plugin.
Read more >
The Dependency and Plugin Hell That is Jenkins - Harness
When it comes to dependencies, things can get very convoluted, very quickly. The more plugins you have, the more likely there is to...
Read more >
jenkins 2 dependency errors loading some plugins
There are dependency errors loading some plugins: Pipeline: Stage View Plugin v2.4 pipeline-rest-api v2.4 is missing. To fix, install v2.4 or ...
Read more >
Plugins are disabled during startup due to unsatisfied ...
confluence-business-blueprints are unable to be startup due to unsatisfied dependency on the objectClass=com.atlassian.streams.spi.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found