Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect docx format in electron #60

Closed
endling1 opened this issue Feb 6, 2018 · 2 comments
Closed

Incorrect docx format in electron #60

endling1 opened this issue Feb 6, 2018 · 2 comments

Comments

@endling1
Copy link

endling1 commented Feb 6, 2018

Hi,
Thank you for this library.

I am using docx in an electron application.
It works great when run with electron directly but seems to create an unreadable docx file when run after packaging the app using electron-packager.
The file is created and has content but it cannot be read by any docx file readers.
Any idea why this might be happening ?

For instance, these two files contain the same content, the letter 'd', but still seem to differ
Before packaging
After packaging

@endling1
Copy link
Author

endling1 commented Feb 6, 2018

docx uses __dirname in some files
When packaged using webpack into a bundle, I think these paths were being resolved incorrectly after packaging ?

const nodeExternals = require('webpack-node-externals')
externals: [nodeExternals({
       whitelist: [/^(?!docx$).*/]
   })] 

Excluding docx into the build using webpack-node-externals fixed it

@endling1 endling1 closed this as completed Feb 6, 2018
@dolanmiu
Copy link
Owner

dolanmiu commented Feb 6, 2018

Yes, I am getting rid of __dirname, as I am aware it is a bit inconsistent

Bare with me, next release will be solid 😄

It's bad that workarounds like this is needed to get this module working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants