0

I am trying to build my code but keep getting this error

[!] (plugin commonjs--resolver) SyntaxError: The keyword 'package' is reserved (4:6) in C:\Users\name\Desktop\elias\repo\repo\node_modules\flutterwave-node-v3\services\banks\rave.banks-branches.js
2: const q = require('q');
3: const axios = require('axios');
4: const package = require('../../package.json');
         ^
5:
6: const spec = morx.spec()
SyntaxError: The keyword 'package' is reserved (4:6) in C:\Users\computer name\Desktop\name\name\name\node_modules\flutterwave-node-v3\services\beneficiaries\rave.create.js

its nothing to do with the code. here is my rollup config file

const resolve = require("@rollup/plugin-node-resolve")
const commonjs = require("@rollup/plugin-commonjs")
const json = require("@rollup/plugin-json")
const builtins = require("builtin-modules")

module.exports = {
  input: "autotasks/relay/index.js",
  output: {
    file: "build/relay/index.js",
    format: "cjs",
    exports: "auto",
  },
  plugins: [
    resolve({ preferBuiltins: true }),
    commonjs(),
    json({ compact: true }),
  ],
  external: [
    ...builtins,
    "ethers",
    "web3",
    "axios",
    /^defender-relay-client(\/.*)?$/,
  ],
} 

failed to get any meaningful solutions from the GitHub issues and the package repo has been archived. any help would be appreciated.

elias
  • 31
  • 3
  • The error message says the problem is with [flutterwave-node-v3](https://github.com/Flutterwave/Node). You should probably raise the issue there. – RoToRa Nov 02 '22 at 08:25
  • the issue comes when bundling with rollup because the name package is reserved in rollup – elias Nov 02 '22 at 09:26
  • It's not reserved in rollup, it's reserved in JavaScript. – RoToRa Nov 02 '22 at 15:21
  • I failed to bundle the package with rollup but I was able to when I used webpack instead. So clearly it's either the package or rollup. I don't think it can be javascript as it would have not allowed the creation of the package in the first place. – elias Nov 02 '22 at 17:39
  • Read https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Lexical_grammar#future_reserved_words . Under "Future reserved words" `package` is listed. If the code is run in strict mode. Yes, it could be indirectly rollup, because it's triggering an unexpected mode, but in the end flutterwave shouldn't be using a reserved word in their code. – RoToRa Nov 03 '22 at 07:59
  • thank you @RoToRa for that reference. I guess I should open an issue with flutterwave on this. – elias Nov 03 '22 at 09:35

0 Answers0