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 any way to stop the file extensions from getting added?
My workaround is this, which is extremely hacky, and I run after every build:
sed -i -e s/'extends.js'/'extends'/g ./dist/server/entry-server.js
sed -i -e s/'assertThisInitialized.js'/'assertThisInitialized'/g ./dist/server/entry-server.js
sed -i -e s/'inheritsLoose.js'/'inheritsLoose'/g ./dist/server/entry-server.js
sed -i -e s/'wrapNativeSuper.js'/'wrapNativeSuper'/g ./dist/server/entry-server.js
sed -i -e s/'taggedTemplateLiteralLoose.js'/'taggedTemplateLiteralLoose'/g ./dist/server/entry-server.js