NaturalIntelligence / fast-xml-parser

Validate XML, Parse XML and Build XML rapidly without C/C++ based libraries and no callback.
https://naturalintelligence.github.io/fast-xml-parser/
MIT License
2.54k stars 306 forks source link

Issue with dependencies in production #375

Closed josep11 closed 3 years ago

josep11 commented 3 years ago

Description

When building an app for production some dependencies are missing. Why is that? because they are listed as devDependencies so when we run either of the following commands they are not there.

npm prune --production
npm install --production

Code

Doesn't apply

Output

This is the log output from production (AWS):

{ "errorType": "Runtime.ImportModuleError", "errorMessage": "Error: Cannot find module 'he'\nRequire stack:\n- /var/task/src/xmlparser.js\n- /var/task/src/DigitalNomads.js\n- /var/task/handler.js\n- /var/runtime/UserFunction.js\n- /var/runtime/index.js", "trace": [ "Runtime.ImportModuleError: Error: Cannot find module 'he'", "Require stack:", "- /var/task/src/xmlparser.js", "- /var/task/src/DigitalNomads.js", "- /var/task/handler.js", "- /var/runtime/UserFunction.js", "- /var/runtime/index.js", " at _loadUserApp (/var/runtime/UserFunction.js:100:13)", " at Object.module.exports.load (/var/runtime/UserFunction.js:140:17)", " at Object. (/var/runtime/index.js:43:30)", " at Module._compile (internal/modules/cjs/loader.js:999:30)", " at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)", " at Module.load (internal/modules/cjs/loader.js:863:32)", " at Function.Module._load (internal/modules/cjs/loader.js:708:14)", " at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)", " at internal/main/run_main_module.js:17:47" ] }

Proposed solution:

move 'he' dependency to 'dependencies' instead of 'devDependencies'

Would you like to work on this issue?

Bookmark this repository for further updates.

github-actions[bot] commented 3 years ago

I'm glad you find this repository helpful. I'll try to address your issue ASAP. You can watch the repo for new changes or star it.

josep11 commented 3 years ago

Sorry my bad. It only happens when using the snippet from the main page:

var parser = require('fast-xml-parser');
var he = require('he');