A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/webpack/webpack/issues/1626 below:

Double loader application when using configuration & require loader directive in same app. · Issue #1626 · webpack/webpack · GitHub

My feeling is that something like this should not result in a webpack compilation error which seems to occur because the loader is applied twice, or that there should be someway to do this, such that it doesn't result in an error.

//a.js
  require('json!./foo.json')
//b.js
  require('./foo.json')

//webpack.config.js
  module.exports {
    //..
    modules : {
      loaders: [
        { test: /\.json$/, loader: "json" }
      ]
    }
  };

This has come up in our application because we still run unit tests for the moment vis-a-vis requireJS, but would like to transition new modules to commonJS syntax (no overloaded requires).

I had hoped that making the loader.test a function would allow me to do something like this:

ƒ(filename) {
  return /\.json$/.test(filename) && (! /^json\!/.test(filename))
}

But the filename argument does not include the loader directive.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4