Add pure annotations option #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "add-pure-annotations-option"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Adds
--source-mapand--disable-pure-annotationscommand line options to cm-buildhelper.We're using https://github.com/replit/codemirror-emacs and found it not working correctly in production mode, which I traced to the presence of incorrect
/*@__PURE__*/annotations in the index.js built by cm-buildhelper, one of which results in a crucial method call being stripped by Terser. Rather than rewrite perfectly valid code to work around it, I've instead added an option to omit the/*@__PURE__*/annotations here. I admit I'm not sure what the consequences are for tree-shaking in this case, if any.Does using @marijn/buildtool instead of @codemirror/buildhelper (which is a special-purpose tool for building the core CodeMirror packages, not intended to be flexible) work for you?
This looks perfect, thank you. I didn't know this existed.
However, I'm seeing an error. I have a very simple build script,
bin/build.js:In
src/index.ts, the first line isimport { BlockCursorPlugin, hideNativeSelection } from "./block-cursor"... which imports
src/block-cursor.ts. However, runningbuild.jsgives me the following error:Error: Could not resolve './block-cursor' from src/index.jsChanging the import in index.js to
"../src/block-cursor"fixes it.Is there something awry in these lines https://github.com/marijnh/buildtool/blob/main/src/buildtool.ts#L174-L179 or am I just being stupid (a distinct possibility)? I am confused because this bit of code looks identical to the equivalent bit in @codemirror/buildhelper, which works, at least when I use it via
cm-buildhelper.Ah, all is well if I pass an absolute path into
build(), so I'm guessing that's the intention.Pull request closed