You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If the package.json for a project has enabled ES6 modules by including
"type": "module",
then it is not possible to use a JavaScript view.
If you try to create a view with a .js extension then you get an error such as the following:
(node:14179) Warning: require() of ES modules is not supported.
require() of /home/eobrain/src/mergi/template/index_view.js from /home/eobrain/src/mergi/node_modules/mustache/bin/mustache is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index_view.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/eobrain/src/mergi/package.json.
internal/modules/cjs/loader.js:1163
throw new ERR_REQUIRE_ESM(filename);
If you try to solve the problem by renaming the view to have a .cjs suffix you get an error such as the following
Shooot, could not parse view as JSON.
Tips: functions are not valid JSON and keys / values must be surround with double quotes.
SyntaxError: Unexpected token m in JSON at position 0
because it is not recognized as being JavaScript and it is being parsed as JSON.
The text was updated successfully, but these errors were encountered:
If the package.json for a project has enabled ES6 modules by including
then it is not possible to use a JavaScript view.
If you try to create a view with a
.js
extension then you get an error such as the following:If you try to solve the problem by renaming the view to have a
.cjs
suffix you get an error such as the followingbecause it is not recognized as being JavaScript and it is being parsed as JSON.
The text was updated successfully, but these errors were encountered: