fix: add dual build support for ESM and CommonJS#61
Conversation
|
I opened a project that was working back in January, and it wouldn't build, so I had to patch it: and then ran Only, now, when I export I get an empty file, just like you describe here: #56 (comment) I tried both of these: and my original In both cases, no errors are generated, but the .docx file is empty. Any ideas why this is happening? Thanks. |
|
Hi @kinecology, I tested it before and found that this PR(https://github.com/curvenote/prosemirror-docx/pull/53/files) caused the problem. You can use version 0.4.1. |
|
Thanks @condorheroblog , so, use 0.4.1 for now, but after you merge this, probably my problem will be fixed, correct? |
|
No, I just reminded @dan-cooke that his PR had this problem, but I didn't make any fixes for his PR, and he didn't make any commits to fix it, so before this problem is fixed, versions after 0.4.1 will have this problem😂. |
|
Ok. I just reverted to 0.4.1, and now it exports the text to the docx, but any images are missing. It was working with images before; like I say, my code was working in January. Do you think maybe a version slightly newer than 0.4.1 might work? (Below, the theEditor.saveDocx = async () => {
let imgBufferMap : Map<string, Buffer> = await noteAttachments.getAllImageBuffersMap();
console.log("imgBuffers ~", imgBufferMap); // I can see the image data
editor.action((ctx) => {
const state = ctx.get(editorStateCtx)
const opts: any = {
getImageBuffer(src: string) {
return imgBufferMap.get(src);
},
};
const wordDocument = defaultDocxSerializer.serialize(state.doc, opts);
writeDocx(wordDocument, (buffer: any) => {
const blob = new Blob([buffer]);
fileSave(blob, {
fileName: "Journal_Export.docx",
extensions: ['.docx'],
}).then(() => {
console.log("saved docx.");
});
});
});
}; |
|
@kinecology I think you can delete all the changes involved in PR (https://github.com/curvenote/prosemirror-docx/pull/53/files), do not use it through Before the problem is solved, I think this solution is feasible😂. |
Reopen #56