Avoid importing .json files (#12759)

* Avoid importing `.json` files

* Use ESold in babel.config.json

* Use `import/extensions` eslint plugin
This commit is contained in:
Nicolò Ribaudo
2021-02-05 23:34:36 +01:00
committed by GitHub
parent 87f264cc7b
commit e735266dee
28 changed files with 101 additions and 42 deletions

View File

@@ -88,13 +88,14 @@ export default function () {
? packageJson["browser"]
: packageJson["main"];
const asJS = path.normalize(
let asJS = path.normalize(
path.join(
packageFolder,
// replace lib with src in the package.json entry
filename.replace(/^(\.\/)?lib\//, "src/")
)
);
if (!/\.[a-z]+$/.test(asJS)) asJS += ".js";
const asTS = asJS.replace(/\.js$/, ".ts");
try {