Adobe-CEP / CEP-Resources

Tools and documentation for building Creative Cloud app extensions with CEP
https://www.adobe.io/apis/creativecloud/cep.html
1.61k stars 824 forks source link

CEP 11.1 Character Encoding Issue Breaking Module Import #500

Open repli-a opened 11 months ago

repli-a commented 11 months ago

I am trying to import and use React Query Devtools, but when I do I get the following error: Uncaught SyntaxError: Invalid or unexpected token @ index.2eb963e7.js:156937

I went and found the corresponding line in the bundle which corresponds to the first line of the character map in this module export:

{"@parcel/transformer-js/src/esmodule-helpers.js":"flGkb"}],"5cRJZ":[function(require,module,exports) {
/**
 * match-sorter-utils
 *
 * Copyright (c) TanStack
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
parcelHelpers.defineInteropFlag(exports);
parcelHelpers.export(exports, "compareItems", ()=>compareItems);
parcelHelpers.export(exports, "rankItem", ()=>rankItem);
parcelHelpers.export(exports, "rankings", ()=>rankings);
const characterMap = {
    À: "A",
    �: "A",
    Â: "A",
    Ã: "A",
    Ä: "A",

At first I thought this was a bundler transformer/loader compatibility issue, but I was unable to reproduce anywhere but within the panel. The bundled code works fine everywhere else, and the character map looks like this:

     À: "A",
    Á: "A",
    Â: "A",
    Ã: "A",
    Ä: "A",

I then thought that maybe this was a Chrome version issue since CEF is running about two years behind, but I downloaded old versions as early as Chromium 86 and wasn't able to reproduce in codesandbox or the local dev server, only when debugging from the panel at localhost:8000. It seems that there is some other component internal to CEP (NW.js? Node?) that is causing this, but I'm at a loss as to what it is.

React Query works nicely within the panel which is great, but it would be nice to be able to use the devtools to better debug things in a meaningful context with all of the components of the application at our disposal for testing, rather than having to go to the trouble of mocking something up in a browser that approximates it solely for testing purposes.

Since it's not likely a fix will be forthcoming, is there possibly a workaround? Something that could be hardcoded in CEP or configured in the bundler/transpiler to fix whatever encoding issue is going on here?

schroef commented 10 months ago

Dont you need to use html ascii coded special characters? In JSX i used this method and thats the only method they show and dont break scripts. Perhaps its not related, but its worth a try.