Open alexbenitez opened 5 years ago
OK... I guess I answered part of my own question... I copied the node_modules to the site and started to work. Not sure if this an adequate setup but is there anyway to configure the NodeServices so "require("jsreport-core") resolves modules from the same Angular location in a Production environment? (dist folder)
You can use webpack to build your "./wwwroot/js/pdf" file as that will bundle "jsreport-core" with your script. Then you can run that script on NodeServices without needing to copy over the node_modules folder.
You can add it to entry of your webpack config and it should build the "./wwwroot/js/pdf" file from source.
entry: { 'pdf': './src/pdf.ts' }
I'm using this starter and I have question regarding NodeServices and the webpack configuration.
I have a webapi method that creates and returns a PDF. I'm using NodeServices to run a js script that uses jsreport to convert from HTML to PDF. Everything works in my development machine. However, when I publish and deploy to IIS I'm getting an exception because the js script ran by NodeService can't locate a module it needs (
var jsreport = require('jsreport-core')();
.This is the Web API
This is the package.json (used by the script ran by NodeServices)
This is the script NodeServices is executing (which fails with module not found trying to get the jsreport-core module)
As I mention, if I debug/F5 everything works fine. However it doesn't when targeting Prod and publishing to IIS.
What should I do to embed this javascript file with webpack (so it is part of the "dist" files) an ensure that it successfully works when it requires its npm dependencies it needs (in this case the jsrepor-core module)?