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.

package.json `main` doesn't point to a commonjs module

See original GitHub issue

It’s my first run at trying out ivi with node and since node doesn’t support import/export statements it throws an exception:

/myproject/node_modules/ivi/dist/js/ivi.js:7
export { DEV_MODE, setDevModeFlags, printError, printWarn } from "./dev_mode/dev_mode";
^^^^^^
SyntaxError: Unexpected token export

Seeing that both webpack and rollup look for the key module first before looking at main in package.json. We could easily get the best of both worlds.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
localvoidcommented, Jul 8, 2017

Added commonjs modules for all packages. I can also add flattened UMD bundles, so it will be possible to use them directly from unpkg cdn.

2reactions
localvoidcommented, Jul 8, 2017

I just wanted to beat marko in their own benchmarks 😃

“Compared to solutions based on JSX that exclusively do virtual DOM rendering, Marko has a huge advantage for server-side rendering.” Why is Marko Fast

And simple recursive dump won’t be able to compete in their benchmarks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Please point to a common-js module in package.json's "main ...
The main field in package.json does not point to a common-js module, rather an es6 module. This means that components that import it...
Read more >
How to choose 'module' instead of 'main' file in package.json
I noticed that using Node, importing an esm file is not possible because of export default , it has to be commonJS. I...
Read more >
Node Modules at War: Why CommonJS and ES ... - Code Red
Node normally dedupes modules, but Node doesn't know that your CJS and your ESM are the “same” files, so your code will run...
Read more >
package.json - npm Docs
The main field is a module ID that is the primary entry point to your program. That is, if your package is named...
Read more >
API - esbuild
API. The API can be accessed in one of three ways: on the command line, in JavaScript, and in Go. The concepts and...
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