question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing "module" field in package.json

See original GitHub issue

Hello, i find easy-peasy.esm.js in the dist folder, but there is no “module” filed in package.json, this will cause module resolver error in some module bundler (eg: Vite).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
435352980commented, Nov 19, 2020

vite requires ES module, it use rollup to compile. https://github.com/rollup/rollup/wiki/pkg.module

Although Vite supports compiling CJS modules as ESM

// vite.config.json
import * as reactPlugin from 'vite-plugin-react';
const config = {
  outDir: path.join(__dirname, 'dist'),
  root: path.join(__dirname, 'src'),
  jsx: 'react',
  plugins: [reactPlugin],
  // support cjs
  optimizeDeps: {
    include: ['easy-peasy'],
  },
}
export default config

But I found easy-peasy.esm.js in the release package image Nothing in package.json for it. https://github.com/ctrlplusb/easy-peasy/blob/70253e5dd8fa2a4d0ededd0cc7cb81cfcc26f3a9/package.json#L6-L9

0reactions
ctrlplusbcommented, Feb 25, 2021

Fixed in the latest release!

Read more comments on GitHub >

github_iconTop Results From Across the Web

A module may be missing from 'dependencies' in package.json
`Cannot find module 'internal/util/types' is the error I get, I am trying to build a discord.js bot and push it to heroku.
Read more >
module field in package.json doesn't point to an esm ... - GitHub
Describe the bug module field in package.json points to minified version of the library. Also causes issues when using npm link across ...
Read more >
package.json - npm Docs
If there is a .gitignore file, and .npmignore is missing, .gitignore 's ... The main field is a module ID that is the...
Read more >
Modules: Packages | Node.js v19.3.0 Documentation
In a package's package.json file, two fields can define entry points for a package: "main" and "exports" . Both fields apply to ...
Read more >
Using Node.js Modules with npm and package.json: A Tutorial
In this cloud tutorial, we will walk you through the detailed steps of using Node.js modules with npm and package.json. Node.js is an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found