question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import with wildcard not working

See original GitHub issue

Do 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

5reactions
trullockcommented, Oct 7, 2020

would be lovely if wildcard globbing worked

0reactions
SassNinjacommented, Jan 31, 2018

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java import wildcard not importing everything inside package
If the event package is inside java.awt and I used the wildcard * to import everything, then why is it not being imported??...
Read more >
Avoid Java wildcard imports… but why? | by Alonso Del Arte
The biggest problem with blanket imports, in my opinion, is that it obscures the programmer's intent. If you're not using absolutely everything ...
Read more >
How To Correct For Wild Card Imports
If the brute force approach previously described does not work or appeal to you, the steps below will walk you through the process...
Read more >
Wildcard import settings do not seem to work - YouTrack
Wildcard import settings do not seem to work ... If I set the settings "Preferences -> Editor -> Code Style -> Java ->...
Read more >
Is it bad to use wildcard imports in Java? | by Dilan Tharaka
Is it really matter having wildcards in import statements in Java? Purpose of this article is to discuss the above problem. I'm approaching...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found