I have this plugin version number in package.json file that I am trying to get but I was unable to import package.json. I am getting this error "Module not found: You attempted to import /package.json which falls outside of the project src/ directory. Relative imports outside of src/ are not supported."
import React from "react";
import { withTaskContext } from "@twilio/flex-ui";
import "./styles.css";
import TextField from "@material-ui/core/TextField";
import FormControl from "@material-ui/core/FormControl";
import Button from "@material-ui/core/Button";
import PropTypes from "prop-types";
import DropDown from "../style/dropdown";
import packageJson from "/package.json";
class VoiceCallComponent extends React.Component {
...
...
console.logh("version number ", packageJson.version);
}
This is my package.json
{
"name": "plugin-sample",
"version": "1.0.0",
"private": true,
"scripts": {
"postinstall": "flex-plugin pre-script-check"
}
}