jsencrypt
jsencrypt copied to clipboard
Is `version.json` necessary ? [rollup problem]
[!] Error: Unexpected token (Note that you need @rollup/plugin-json to import JSON files)
node_modules/jsencrypt/lib/version.json (1:10)
1: {"version": "3.1.0"}
^
Error: Unexpected token (Note that you need @rollup/plugin-json to import JSON files)
...
Do I really need to install and configure json plugin for rollup?
I have complicated rollup configuration and for such tiny thing adding plugin to all files will be troublesome.
Maybe you can remove JSEncrypt.version
property or add next compilation step to replace value inside compiled file instead of importing this json file?
Yeah, I agree that it should not be importing this in the "lib" files. I will include this change in next release, or it will go much faster if someone submitted a pull request to fix it and I will get the release out quickly to change it.
Hi, is it solved? I'm still having this issue when building webpack boundle.
I was able to get this working with webpack by first running npm i -D @rollup/plugin-json
, then adding this to my rollup.config.js
:
import json from '@rollup/plugin-json'
export default {
plugins: [
// add this to your plugins
json()
]
}
I get this warning on build, but all works correctly so far:
(!) `this` has been rewritten to `undefined`
https://rollupjs.org/guide/en/#error-this-is-undefined
node_modules/jsencrypt/lib/JSEncryptRSAKey.js
1: var __extends = (this && this.__extends) || (function () {
^
2: var extendStatics = function (d, b) {
3: extendStatics = Object.setPrototypeOf ||
...and 1 other occurrence
My setup: jsencrypt: 3.2.1 rollup: 2.77.0 svelte: 3.49.0 typescript: 4.7.4