Skip to content

pref parsing error with backquote #111

@wohenbushuang

Description

@wohenbushuang

Hi, I have no idea how to deal with my prefs when upgrading to the new plugin template using this new scaffold that requires pref parsing.

pref("log-prefix", `🔵`);

can produce

  ERROR  Error: Invalid prefs.js file - unsupported value type.
Error: Invalid prefs.js file - unsupported value type.
    at PrefsManager.parse (file:///.../node_modules/zotero-plugin-scaffold/dist/shared/zotero-plugin-scaffold.Be6yYGJh.mjs:404:17)
    at PrefsManager.read (file:///.../node_modules/zotero-plugin-scaffold/dist/shared/zotero-plugin-scaffold.Be6yYGJh.mjs:532:22)
    at async Build.preparePrefs (file:///.../node_modules/zotero-plugin-scaffold/dist/shared/zotero-plugin-scaffold.Be6yYGJh.mjs:786:5)
    at async Build.run (file:///...node_modules/zotero-plugin-scaffold/dist/shared/zotero-plugin-scaffold.Be6yYGJh.mjs:640:5)

, but pref("log-prefix", "🔵"); works.

Besides, I have other prefs which store json string such as

pref("ppp", `{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3",
}`);

The backquote is required because it will keep the json pref having a better format.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions