Read content of json // experimental syntax 'importAssertions' isn't currently enabled

Hello,

how can I use a json file within a forge app?
Thank you for reading and answering

Luis

Error: Bundling failed: ./src/config.jsx

Module build failed (from /tunnel/node_modules/babel-loader/lib/index.js):
> SyntaxError: /app/src/config.jsx: Support for the experimental syntax 'importAssertions' isn't currently enabled (30:48):

  29 |
> 30 | import insightSchemeMapping from "./insightSchemeMapping.json" assert { type: "json" };

this does not work too for me:
const SCHEME_JSON = require('./azureadscheme.json');

Importing the file without the import assertion should work:

import insighSchemeMapping from "./insighSchemeMapping.json";
1 Like

Related: Using alternate version of TypeScript

(since this syntax is supported only in TypeScript 4.5+)

1 Like