You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a JS ESM project, and want to try Next.
But I see the import next/image gives me linting error's, because the path isn't valid.
See also: https://nodejs.org/api/esm.html#mandatory-file-extensions
So in that case it looks like I have to do:
importImagefrom'next/image.js'
But NPM has designed a main to define the file in package.json.
Why refer to a file in the package, that sounds weird for me.
Feels like a hack to pick just a random file from the package.
Proposal
In the file defined at main in the package.json should also export Image, so you can just do
import{Image}from'next'
Or deploy seperate packages, so Image will a new package, and you can import it like e.g.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
No response
Background
I have a JS ESM project, and want to try Next.
But I see the import next/image gives me linting error's, because the path isn't valid.
See also: https://nodejs.org/api/esm.html#mandatory-file-extensions
So in that case it looks like I have to do:
But NPM has designed a main to define the file in package.json.
Why refer to a file in the package, that sounds weird for me.
Feels like a hack to pick just a random file from the package.
Proposal
In the file defined at main in the
package.json
should also export Image, so you can just doOr deploy seperate packages, so Image will a new package, and you can import it like e.g.
Beta Was this translation helpful? Give feedback.
All reactions