Issue
This Content is from Stack Overflow. Question asked by dagda1
I am using @babel/runtime
with the useESModules: true
options and it is causing helpers to be emitted like this with the .js
file extension
import "@babel/runtime/helpers/esm/extends.js";
This causes the following error:
[ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath ‘./helpers/esm/extends.js’ is not defined by “exports” in
myproject/node_modules/@babel/runtime/package.json
This is because this path conflicts with the package.json
exports subpath pattern:
"exports": {
"./helpers/extends": [
{
"node": "./helpers/extends.js",
"import": "./helpers/esm/extends.js",
"default": "./helpers/extends.js"
},
Removing the file extensions fixes this problem.
Is there anyway to stop the file extensions getting added?
Solution
This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.
This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.