webpack: Loader.exec method does not eval loaders

Hit a snag where trying to run the exec method on a require statement that has a loader in it, causing it to fail out.

Not sure what solutions are available here, but it would be nice to have loader require support within exec or document how to properly “polyfill require” that the val-loader alludes to.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 7
  • Comments: 16 (4 by maintainers)

Most upvoted comments

Hit on this on webpack 2.

I’m not sure if this will be helpful, but I ultimately ended up solving my issue by using the _compilation.createChildCompiler functionality. If you’re interested, you can see how I do that here.

I quickly put together a version of val-loader that uses a child compiler based on the work done by Nathan Tran for css-in-js-loader.

See https://github.com/wikiwi/value-loader.

Same problem as @kpdecker here. I have to build a static json (tojson-loader) that depends on a image path (file-loader). I made this repository to explain the error: https://github.com/machadoum/webpack-loader-loader

Any idea?