Cannot keep source file sub-directories
See original GitHub issueI try to use webpack with vinyl-name
to compile my scripts like the demo:
var gulp = require('gulp');
var webpack = require('webpack-stream');
var named = require('vinyl-named');
gulp.task('default', function() {
return gulp.src(['src/*.js', 'src/**/*.js'])
.pipe(named())
.pipe(webpack())
.pipe(gulp.dest('dist/'));
});
But js files in src/**
are compiled to the root directory in dist/
like this:
- src/base.js --> dist/base.js // This is right
- src/user/login.js --> dist/login.js // This should be in
dist/user/login.js
How can I make it right?
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Sources from subdirectories in Makefile - Stack Overflow
I always list every single object file in my Makefiles and sometimes every single source file. Listing a few directories to loop over...
Read more >Not able to copy entire files and folders recursively in specific ...
Hi,. I want to copy data between two adls gen2 accounts. I am unable to copy all files and subfolders in specific folder...
Read more >Working With Files - Gradle User Manual
Almost every Gradle build interacts with files in some way: think source files, ... reports directory, including all its subdirectories, to the destination:....
Read more >file — CMake 3.25.1 Documentation
If no CMakeLists.txt file changes when a source is added or removed then the generated build system cannot know when to ask CMake...
Read more >Enhanced source file handling with target_sources() - Crascit -
This in turn means that subdirectories cannot directly call ... Let's now assume the source files in the foo subdirectory use features from ......
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 FreeTop 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
Top GitHub Comments
According to reported issues, webpack does not support multiple output paths yet.
Nevertheless, there are some workarounds:
Apparently, you can use a combination of vinyl-named and gulp-rename in order to recreate the directory structure. You have to pipe your sources twice through gulp-rename, once for caching the original directory of your input, once for restoring the cached attribute.
It is an ugly and questionable solution, but it should do the job as long as the webpack module isn’t fixed.
Note that this example works solely when you supply globs which match across directories (e.g. a gulp.src-pattern like [‘src/1.js’, ‘src/sub/3.js’] would not work correctly).
You should write your own gulp-rename callback functions and have a look at the base option of gulp.src, too.
vinyl-named-with-path can solve my issue.