wire.js with webpack

67 views
Skip to first unread message

Denis Savenok

unread,
Nov 30, 2015, 9:26:34 AM11/30/15
to cuj...@googlegroups.com
When using wire.js with webpack 'require function is used in a way in which dependencies cannot be statically extracted' error appears. 
How to avoid it?

Thanks

Denis Savenok

unread,
Jan 19, 2016, 2:54:35 AM1/19/16
to cuj...@googlegroups.com
It can be avoided with ContextReplacementPlugin.
There is the problem with webpack relationship with require function.
Webpack tries to evaluate the request expression in the line https://github.com/cujojs/wire/blob/master/wire.js#L25. Request function does not work here in the usual way - it's rewritten with inner webpack '__webpack_require__' function with request to context module. As the result of recording phase the context module created by webpack has all inner files mapped.

Reply all
Reply to author
Forward
0 new messages