A way to import directly source files?

Hi,

to debug i usually find it very useful to be able to import directly from a project’s source files (not compiled ones).

However while doing import * from "prosemirror-view/src/index.js" is possible, it won’t really work because the first thing it does is import {NodeSelection} from "prosemirror-state" which loads the compiled files by default.

I wonder why ? The es modules are clearly not meant to be used on old browsers, so package.json might as well just declare es exports as the original sources, and commonjs exports as compiled bundles ?

No, this indeed isn’t something the library supports. It also doesn’t seem a very compelling thing to provide—loading that many small modules is going to be noticeably slower, and you can just set up a watching build process if you want to edit-and-debug.

well, since it’s for debugging/developing purposes it’s all right to load a little slower.

Also with hot code reloading and local files in chrome (and firefox maybe) devtools, one can modify src/ files without always reloading the page.

There is a big advantage with this approach - you can program the original source file live, right in the browser.

However i made some modules (based on some of your work) to serve/bundle es/cjs modules. I could add the ability to overwrite default resolutions (so that “prosemirror-view” → “dist/index.es.js” becomes → “src/index.js” on the fly) and it’s really cool to debug using live original sources.