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