How to debug Rollup build output with a massive encoding log?

Viewed 3702

I recently built a library with Rollup that has a few non-usual bits. That includes for instance, loading up a wasm module, workers with importScripts and a few occurences of eval() in the global scope.

Now I used the rollup-starter-app to create a demonstrator and client app for that library. The repo is https://github.com/frantic0/sema-engine-rollup

I managed to get everything working, after hitting a few walls and adding the following rollup plugins

import { wasm } from "@rollup/plugin-wasm";
import workerLoader from "rollup-plugin-web-worker-loader";
import dynamicImportVars from "@rollup/plugin-dynamic-import-vars";
import copy from "rollup-plugin-copy";

However, in the build output, I'm getting this massive log of what seems to be some encoding...

https://github.com/frantic0/sema-engine-rollup

I'm not sure where this log is coming from and it is so massive that it clears out all the information of the build in the terminal...

What is the best way to tackle this issue and how to debug it effectively?

1 Answers

based on the suggestion @lukastaegert on the rollup issues, one solution is to redirect stderr into a file to read the log.

To do that you can add the following to your rollup command

"rollup -cw 2>err.log 1>out.log"

this allows to further inspect the build log but doesn't solve the error

[EDIT]

After a bit of peeking around Rollup's github issues and source, I found the warning categories and how to deactivate warnings.

Basically, we need to add a function onwarn to rollup.config.js. The first code section below shows the function. The second one show where we should add it on the rollup.config.js

const onwarn = (warning) => {
    // Silence warning
    if (
        warning.code === 'CIRCULAR_DEPENDENCY' ||
        warning.code === 'EVAL'
    ) {
        return
    }

    console.warn(`(!) ${warning.message}`)
}
export default {= {
            inlineDynamicImports: !dynamicImports,
            preserveEntrySignatures: false,
      onwarn,
            input: `src/main.js`,
            output: {
Related