pubkey / jsonschema-key-compression

Compress json-data based on its json-schema while still having valid json

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build error when migrating from Rollup 1.x to 2.x (via StencilJS, RxDB)

chrisweight opened this issue · comments

Hey!

We are consuming rxdb@9.3.0 in a StencilJS app.

When building with @stencil/core@1.31.0 (which uses rollup@1.32.0), the app builds without an issue.

If I bump the StencilJS dependency to >=@stencil/core@1.14.X (which uses >= rollup@2.10.9) the build fails with the following error:

[ ERROR ]  Rollup: Parse Error: ./node_modules/jsonschema-key-compression/src/compress.ts:12:9
           Unexpected token (Note that you need plugins to import files that are not JavaScript)

     L11:  export function compressObject(
     L12:      table: CompressionTable,
     L13:      obj: PlainJsonObject

If I then manually add the @rollup/plugin-typescript to the rollup build plugins, the build error changes, and is now:

[ ERROR ]  Rollup: Plugin Error
           Could not load
           /{REDACTED}/app/node_modules/jsonschema-key-compression/src/index.ts
           (imported by ./node_modules/rxdb/dist/es/plugins/key-compression.js): Debug Failure. False expression:
           Expected fileName to be present in command line (plugin: typescript, load)

stencil/core@1.13.X uses typescript@3.8.3, whereas stencil/core@1.14.0 and greater use typescript@3.9.X and I can see there a failed Renovate PR build bumping to typescript@3.9.6 (#107). This may also have build step implications?

GH comparison for StencilJS versions, at the point at which the build starts to fail: ionic-team/stencil@v1.13.0...v1.14.0

There's a barebones repo highlighting the issue here: https://github.com/chrisweight/jsonschema-build-failure

You can comment out the typescript() plugin in stencil.config.ts to see the first error

Hm strange. I do not think the problem comes from this module, index.ts is only references from the "types" attribute in the package.json.

As workaround you could use a custom RxDB build without the key-compression plugin. Atm you do not do this because you import createRxDatabase from 'rxdb' instead of 'rxdb/plugins/core'

Yep, that does seem to fix the error in the sample repo I created, so you're probably right...cheers!

I am closing this. If it appears also for someone else, we can investigate again.

Ok, looks like the Stencil team are getting a few similar0-ish issues coming in, could be Rollup

I am also getting this error with a fresh installation of RxDB when using typescript and rollup.

(compiling directly with tsc without rollup works fine)