I wish import a file with only an extension (no name) : .sec
. This file contains a json object with security parameters like login and password. The goal is to add the extension in .gitignore
file to never save this file in a git repository.
I use babel-register
and transform-es2015-modules-commonjs
to convert esmodulle
to commonjs
. I added the new extension to babel-register options :
{
"extensions": [".es6", ".es", ".js", ".sec"]
}
If I name the file security.sec
and import it, all works.
But if I name the file .sec
when I import it, I have the error:
Cannot find module '.sec'
So how to import a file without name? Is this the right way to do this? Is there an existing file extension to save security parameter?
You need to specify the path to '.sec'
eg
You could also check out the dotenv module.