webpack-contrib / imports-loader

Imports Loader
MIT License
520 stars 63 forks source link

Is nested import supported ? #22

Closed wuyiw closed 7 years ago

wuyiw commented 8 years ago

for example:

/* foo.js */
module.exports = 1;
/* bar.js */
module.exports = foo + 1;
/* baz.js */
console.log(bar);

i tried:

require('imports?bar=imports?foo!bar!baz'); // webpack error: can't resolve module 'bar'
// or
require('imports?foo,bar!baz'); // runtime error: 'foo' is not defined in bar.js

but neither worked. do i use the wrong syntax or nested import is not supported? (if the latter, maybe i should use loader config or ProvidePlugin.)