error when requiring node modules that use destructuring #415
Closed
Description
I have a node module, where in it's lib there is a file like so:
lib/foo.js
const {APPID} = require('./config');
within App.js, when I require this module
App.js
const myModule = require('myModule/lib/foo')
Now, when I load this in the browser, an error is thrown
Unexpected Token {
This is because webpack has required myModule/lib/foo.js, but has not done any processing on it -- the destructuring is not converted.
This makes sense, as it is indeed a node module outside of our app.
Is there a recommended solution to solve this? I could eject and try to update configuration, but am wishing there is another way
Metadata
Assignees
Labels
No labels