Automatic entries via a glob pattern
See original GitHub issueAt Symfony Live, @trappar had an interesting idea: a way to automatically add entries based off of a glob pattern. For example, perhaps all .js
files in the root of assets/
should be entry files (assets/*.js
). Then it would be cool to be able to say:
Encore.addEntries('assets/*.js')
The one problem is that when you add new files, it would mean that your webpack.config.js
config will need to change (we would need to add the new entry). That’s a problem because you’ll need to restart encore
if you’re using --watch
. So… that’s a bit of a “gotcha” with this feature. We could manually “watch” this directory for new files in Encore and add a notification (#187) in this situation.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
glob (programming)
In computer programming, glob patterns specify sets of filenames with wildcard characters. For example, the Unix Bash shell command mv *.txt textfiles/ ...
Read more >Common glob pattern
The Glob patterns implemented in the File Log Agent is to provide methods to traverse the file system and returning files or the...
Read more >Use glob patterns on the Pipelines yaml file | Bitbucket Cloud
Glob patterns don't allow any expression to start with a star. Learn the glob patterns you can use on the Pipelines yaml file....
Read more >Using Glob Expressions Throughout the LogicMonitor Portal
Glob Syntax. This table below illustrates how to format glob expressions. You can combine these to create more complex expressions: ...
Read more >c# - glob pattern matching in .NET
I like my code a little more semantic, so I wrote this extension method: using System.Text.RegularExpressions; namespace Whatever { public ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@Lyrkan
In the project where I’m doing this I use something like the following to convert a glob path/pattern into an entry object:
I like this because it maintains the same folder structure inside my assets folder when the public versions are built, which allows me to use something like:
globToEntry('assets', '**/*.js')
to turnassets/admin/users.js
intopublic/build/admin/users.js
I personally don’t see having many entry points as a bad practice. Any significantly large MPA is going to end up having tons of them, and that isn’t a terribly inefficient way of building an app as long as common chunks and code splitting are being used properly. Sure moving toward SPA architecture might be more ideal for many applications using Webpack, but that doesn’t mean that this package shouldn’t support other styles of application as well. Just my opinion.
Closing this, at least for now. Not sure it’s a good idea, and there are complications