Hey Im trying to customize my plans and pricing page by following one of Wix Wiz videos on Youtube.
The tutorial was done on Editor X but Im trying to do it on Wix Studio.
Ive made a file inside src > backend called plans.jsw and coded the below
import wixData from 'wix-data';
export const getPlans = async ()=> {
const results = await wixData.query("PaidPlans/Plans").find()
return results.items;
}
when I run the code I get the below error,
/usr/local/bin/node ./src/backend/plans.jsw
(node:220) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
warning:50
Process exited with code 1
Uncaught SyntaxError /user-code/src/backend/plans.jsw:1
import wixData from 'wix-data';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at compileFunction (vm:352:18)
at wrapSafe (internal/modules/cjs/loader:1032:15)
at Module._compile (internal/modules/cjs/loader:1067:27)
at Module._extensions..js (internal/modules/cjs/loader:1157:10)
at Module.load (internal/modules/cjs/loader:981:32)
at Module._load (internal/modules/cjs/loader:822:12)
at executeUserEntryPoint (internal/modules/run_main:77:12)
at <anonymous> (internal/main/run_main_module:17:47)
Could someone help me what Im doing wrong.
Thank you