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.

Packaging doesn't include docx type files.

See original GitHub issue

I am using a docxtemplater on main.dev which is called with ipc. In here, I write data to different docx templates which lies in /app/main-helpers folder.

The sample code that I use for the templatePath can be find in below.

const templatePath = path.join( path.dirname(__filename), 'main-helpers', 'docx-templates', 'single-location-count-control-template.docx' );

Before packaging everything works due to webpack is working in /app folder and the ipc event can find the docx items. After packaging the ipc event cannot find the path, probably because it is not packaged.

Any idea on how to load this folder with webpack on packaging.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9

github_iconTop GitHub Comments

2reactions
ghostcommented, Apr 14, 2018

Based on @dayfine 's comments how to solve this issue.

I made a deep analysis of our code that is using this boilerplate as its base. The problem is occurring because of the reasons that dayfine is indicated.

Inside the main package.json, we have a build configuration that shows the files as an Array. This array is implemented to the project as the bare minimum. Thanks to webpack, these things will be packaged in most of the projects. In our case, the problem was we were never importing the mentioned folder, so webpack cannot handle to carry them to either main.prod.js or dist/ folder.

With investigating the asar resources structure, I have understanded that the main.prod.js is still lying in the same level as in development environment app/.

So adding the folders that is never imported to any of the project files (only defined as absolute paths) is helped me solve this bug (along with 2 unpackaged folders).

As it can be seen that main.prod.js is directly listed in the files section, you should import all other folder and files based on main.dev.js’s folder level.

0reactions
Ancinekcommented, Nov 4, 2018

@musyilmaz Hey there, I’m having a similar issues. In the app folder I have defined a scripts directory with couple of binary scripts inside. I’ve added this do the files so it currently looks like this:

"files": [
      "dist/",
      "node_modules/",
      "scripts/",
      "app.html",
      "main.prod.js",
      "main.prod.js.map",
      "package.json"
    ],

When I run npm run package the files are still not included in the .asar package 😕 Do I have to import those files from the code (so they go through webpack)? Would really appreciate your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

C# DocX Create File - visual studio - Stack Overflow
I just tried installing the DocX NuGet package and there were no dependencies. I just tried your code and, with a change of...
Read more >
Option --include-before-body does not work with docx writer ...
My understanding of reference.docx is that it can only modify style, and not add content. ... Setting the --include-before-body flag to a file...
Read more >
Word App failing to open docx file on Android tablet
It allows me to open some files on direct download but throws this error message with others that are of the same file...
Read more >
Working with Documents - python-docx - Read the Docs
python-docx allows you to create new documents as well as make changes to existing ones. Actually, it only lets you make changes to...
Read more >
docx-templates - npm
TypeScript icon, indicating that this package has built-in type ... Then read this file in an ArrayBuffer, feed it to docx-templates, ...
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