Skip to content
This repository has been archived by the owner on Aug 20, 2018. It is now read-only.

Correct usage? #32

Closed
SystemParadox opened this issue Oct 21, 2016 · 2 comments · Fixed by #39
Closed

Correct usage? #32

SystemParadox opened this issue Oct 21, 2016 · 2 comments · Fixed by #39

Comments

@SystemParadox
Copy link

SystemParadox commented Oct 21, 2016

The README just shows a weird require("json!./file.json"); statement. I want it to work like it does in node.

Please could we have some examples, both for config file and command line usage.

I am trying the following, but it results in an error:

$ webpack --entry ./foo.js --output-filename server.js --module-bind json

/home/simon/npm/lib/node_modules/webpack/lib/NormalModuleFactory.js:217
                        return callback(null, Object.assign({}, item, {
                                                     ^
TypeError: Object function Object() { [native code] } has no method 'assign'
    at /home/simon/npm/lib/node_modules/webpack/lib/NormalModuleFactory.js:217:33
    at onResolved (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:72:10)
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at innerCallback (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:122:22)
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at /home/simon/npm/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:210:15
    at /home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/UnsafeCachePlugin.js:38:22
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at innerCallback (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:122:22)
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at /home/simon/npm/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:210:15
    at innerCallback (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:122:22)
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at /home/simon/npm/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:210:15
    at /home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:42:23
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at afterInnerCallback (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:135:22)
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at next (/home/simon/npm/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:112:35)
    at /home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/ModuleKindPlugin.js:21:36
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at innerCallback (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:122:22)
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at /home/simon/npm/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:210:15
    at innerCallback (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:122:22)
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at /home/simon/npm/lib/node_modules/webpack/node_modules/tapable/lib/Tapable.js:210:15
    at /home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/forEachBail.js:29:14
    at loggingCallbackWrapper (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/createInnerCallback.js:31:19)
    at innerCallback (/home/simon/npm/lib/node_modules/webpack/node_modules/enhanced-resolve/lib/Resolver.js:122:22)

Thanks.

@bebraw
Copy link

bebraw commented Oct 24, 2016

Which version of Node are you using? Older ones are missing Object.assign. I would recommend updating to at least Node 4 or 6.

@SystemParadox
Copy link
Author

Ah yes, it's my appallingly outdated version of node.

However, my request still stands, it would be helpful to have some examples.

Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants