Import with wildcard not working
See original GitHub issueDo you want to request a feature or report a bug? Bug
What is the current behavior?
Importing several files via wildcard is not working.
No matter if I use ES6 native import './riot/tags/*.tag';
or require.context('./riot/tags', false, /\.js$/);
The only way that seems to work is importing without wildcards via import './riot/tags/example.tag';
If the current behavior is a bug, please provide the steps to reproduce.
I’ve got an app.js as bootstraper which imports all components and initializes them. In my case it’s the riot library.
import riot from 'riot';
import './riot/tags/example.tag';
riot.mount('*');
I’m using gulp with the webpack package and the loaders babel & riot-tag
import gulp from 'gulp';
import webpackStream from 'webpack-stream';
import webpack2 from 'webpack';
import named from 'vinyl-named';
let webpackConfig = {
module: {
rules: [
{ test: /.js$/, use: 'babel-loader' },
{ test: /.tag$/, use: 'riot-tag-loader' }
]
}
};
gulp.src('./src/app.js')
.pipe(named())
.pipe(webpackStream(webpackConfig, webpack2))
.pipe(gulp.dest('./dist/app.js'));
What is the expected behavior?
I expected that webpack resolves the import with wildcard correctly.
If this is a feature request, what is motivation or use case for changing the behavior?
Please mention other relevant information such as the browser version, Node.js version, webpack version and Operating System.
- node v.8.6.0
- webpack v3.10.0
- macOS 10.13.2 (High Sierra)
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
would be lovely if wildcard globbing worked
Ok thanks for the explanation. I really thought there has to be a way to use import with global match in webpack. I think I’ll precompile & concatenate the files via gulp then and import the output file.