Closed adityak2502 closed 9 months ago
Do you add re2
as a dependency to your package.json
? If you do, do you run npm i
?
You can do both in one go: npm I --save re2
.
Then you can try to export it.
Yes. To reproduce:
npx create-react-app tmp
cd tmp
npm install --save re2
In src/index.js Add the following
var RE2 = require("re2");
Then
npm run start
This will open http://localhost:3000/ and you'll get the same error
You still create a React application. And it looks like you run it with a server.
Example (do it yourself):
✔ 23:10 ~/temp $ npm init -y
Wrote to ~/temp/package.json:
{
"name": "temp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
✔ 23:10 ~/temp $ npm i --save re2
added 132 packages, and audited 133 packages in 2m
17 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
npm notice
npm notice New major version of npm available! 9.8.0 -> 10.1.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.1.0
npm notice Run npm install -g npm@10.1.0 to update!
npm notice
✔ 23:12 ~/temp $ node -e "console.dir(require('re2'))"
[Function: RE2] {
getUtf8Length: [Function (anonymous)],
getUtf16Length: [Function (anonymous)],
unicodeWarningLevel: 'nothing'
}
In any case, I have no time to learn what create-react-app
does and what kind of npm run start
it creates. Do the commands above and investigate what is the difference between this simple example and whatever is created by the utility.
Closing for inactivity.
PS: Working with packagers like webpack I've noticed that they usually ignore imports with non-textual files, like re2.node
. I suggest to file a bug with them.
I am using node. When I do,
var RE2 = require("re2");
. I getIn index.js:
var RE2 = require("re2");
./node_modules/re2/re2.js :
Symbol.match is on line 6