-
Notifications
You must be signed in to change notification settings - Fork 606
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
Can't import with webpack #629
Comments
|
I too get this issue, not that it helps |
|
@GameCodingNinja @JonathanMSifleet did you fix this issue? |
I ended up using fast-xml-parser instead |
|
I have the same problem, but in my case I don't use some functionalities with xml2js and I've decided my problem with update section |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Installed...
npm install xml2js
npm install @types/xml2js
Trying to add it to a project...
import * as xml2js from 'xml2js';
... throws a bunch of errors. SAX is installed.
asset bundle.js 1.47 MiB [compared for emit] [big] (name: main)
runtime modules 937 bytes 4 modules
modules by path ../ 1.23 MiB
modules by path ../library/ 550 KiB 106 modules
modules by path ../node_modules/ 715 KiB
modules by path ../node_modules/planck-js/lib/ 510 KiB 53 modules
modules by path ../node_modules/xmlbuilder/lib/.js 127 KiB 33 modules
modules by path ../node_modules/xml2js/lib/.js 20.4 KiB 6 modules
2 modules
modules by path ./ 89.1 KiB
javascript modules 82.9 KiB
modules by path ./source/ 69.5 KiB 15 modules
modules by path ./data/objects/ 13.4 KiB 6 modules
json modules 6.18 KiB 11 modules
WARNING in ../node_modules/sax/lib/sax.js 163:13-37
Module not found: Error: Can't resolve 'stream' in '/home/howie/Development/javajcript-webgl-game-engine/node_modules/sax/lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
- install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "stream": false }
@ ../node_modules/xml2js/lib/parser.js 9:8-22
@ ../node_modules/xml2js/lib/xml2js.js 12:11-30
@ ./source/state/startupstate.js 51:0-33 62:8-26
@ ./source/game/game.js 14:0-53 96:29-41
@ ./source/game/main.js 9:0-33 12:15-19
1 warning has detailed information that is not shown.
Use 'stats.errorDetails: true' resp. '--stats-error-details' to show it.
ERROR in ../node_modules/sax/lib/sax.js 233:17-56
Module not found: Error: Can't resolve 'string_decoder' in '/home/howie/Development/javajcript-webgl-game-engine/node_modules/sax/lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "string_decoder": require.resolve("string_decoder/") }'
- install 'string_decoder'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "string_decoder": false }
resolve 'string_decoder' in '/home/howie/Development/javajcript-webgl-game-engine/node_modules/sax/lib'
Parsed request is a module
using description file: /home/howie/Development/javajcript-webgl-game-engine/node_modules/sax/package.json (relative path: ./lib)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
/home/howie/Development/javajcript-webgl-game-engine/node_modules/sax/lib/node_modules doesn't exist or is not a directory
/home/howie/Development/javajcript-webgl-game-engine/node_modules/sax/node_modules doesn't exist or is not a directory
/home/howie/Development/javajcript-webgl-game-engine/node_modules/node_modules doesn't exist or is not a directory
looking for modules in /home/howie/Development/javajcript-webgl-game-engine/node_modules
single file module
using description file: /home/howie/Development/javajcript-webgl-game-engine/package.json (relative path: ./node_modules/string_decoder)
no extension
Field 'browser' doesn't contain a valid alias configuration
/home/howie/Development/javajcript-webgl-game-engine/node_modules/string_decoder doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/home/howie/Development/javajcript-webgl-game-engine/node_modules/string_decoder.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/home/howie/Development/javajcript-webgl-game-engine/node_modules/string_decoder.json doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/home/howie/Development/javajcript-webgl-game-engine/node_modules/string_decoder.wasm doesn't exist
/home/howie/Development/javajcript-webgl-game-engine/node_modules/string_decoder doesn't exist
/home/howie/Development/node_modules doesn't exist or is not a directory
/home/howie/node_modules doesn't exist or is not a directory
/home/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
@ ../node_modules/xml2js/lib/parser.js 9:8-22
@ ../node_modules/xml2js/lib/xml2js.js 12:11-30
@ ./source/state/startupstate.js 51:0-33 62:8-26
@ ./source/game/game.js 14:0-53 96:29-41
@ ./source/game/main.js 9:0-33 12:15-19
ERROR in ../node_modules/xml2js/lib/parser.js 17:17-47
Module not found: Error: Can't resolve 'timers' in '/home/howie/Development/javajcript-webgl-game-engine/node_modules/xml2js/lib'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "timers": require.resolve("timers-browserify") }'
- install 'timers-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "timers": false }
resolve 'timers' in '/home/howie/Development/javajcript-webgl-game-engine/node_modules/xml2js/lib'
Parsed request is a module
using description file: /home/howie/Development/javajcript-webgl-game-engine/node_modules/xml2js/package.json (relative path: ./lib)
Field 'browser' doesn't contain a valid alias configuration
resolve as module
/home/howie/Development/javajcript-webgl-game-engine/node_modules/xml2js/lib/node_modules doesn't exist or is not a directory
/home/howie/Development/javajcript-webgl-game-engine/node_modules/xml2js/node_modules doesn't exist or is not a directory
/home/howie/Development/javajcript-webgl-game-engine/node_modules/node_modules doesn't exist or is not a directory
looking for modules in /home/howie/Development/javajcript-webgl-game-engine/node_modules
single file module
using description file: /home/howie/Development/javajcript-webgl-game-engine/package.json (relative path: ./node_modules/timers)
no extension
Field 'browser' doesn't contain a valid alias configuration
/home/howie/Development/javajcript-webgl-game-engine/node_modules/timers doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/home/howie/Development/javajcript-webgl-game-engine/node_modules/timers.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/home/howie/Development/javajcript-webgl-game-engine/node_modules/timers.json doesn't exist
.wasm
Field 'browser' doesn't contain a valid alias configuration
/home/howie/Development/javajcript-webgl-game-engine/node_modules/timers.wasm doesn't exist
/home/howie/Development/javajcript-webgl-game-engine/node_modules/timers doesn't exist
/home/howie/Development/node_modules doesn't exist or is not a directory
/home/howie/node_modules doesn't exist or is not a directory
/home/node_modules doesn't exist or is not a directory
/node_modules doesn't exist or is not a directory
@ ../node_modules/xml2js/lib/xml2js.js 12:11-30
@ ./source/state/startupstate.js 51:0-33 62:8-26
@ ./source/game/game.js 14:0-53 96:29-41
@ ./source/game/main.js 9:0-33 12:15-19
webpack 5.25.0 compiled with 2 errors and 1 warning in 1189 ms
The terminal process "bash '-c', '../node_modules/.bin/webpack --mode none'" terminated with exit code: 1.
The text was updated successfully, but these errors were encountered: