-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to process each file without bundling? #2561
Comments
That would be challenging to pull off. One idea - generate entries through a glob. Use I'm not sure if this gives you exactly the kind of output you are looking for but it could be worth a go. Before globbing you could process a single file and see how it goes. If that works, generalize. |
@desperate-man you can use
and
|
The problem with this approach is that webpack insert all its boilerplate on top of each processed file (of course, it supposes each one should be a bundle on its own), thus yielding very large files each time. It would be very nice to have the possibility to have webpack process each files with the loaders, plugins etc... without actually treating them as proper entries. For example, this would allow to transpile sources and include them in npm packages very easily. |
You can use file-loader to do this. In your module.rules, set it up to transpile your source and then use file-loader to output the source code as a file. If you are processing content, then use extract-loader also, because content gets transformed into code by most? webpack loaders. eg. This will not scan your dependencies though. You could use multi-loader with one branch using file-loader and another processing as usual (to scan dependencies) but you probably don't want to processing node_modules. |
@rmanoka your suggestion worked for me except that webpack still creates bundles which are unneeded. I have to prefix the Also, this means that I can't use webpacks source maps. :( My use case is that I want to have 2 webpack configs. One for new react code/bundles, and one for old legacy code (hundreds of vanilla JS files that aren't modules or namespaced or anything). That old code is transpiled because there are some ES6 classes and newer browser APIs used. |
I do not want to use neither bundles nor chunks, I just want to process each of the files within "require" and to keep them at them their respective folder. The folders structure is as follows:
Before webpack
After webpack
My idea is to create a config file for webpack, configure the loaders and run webpack to process all of the files in the project folder and to output the result of each ".ts" (will produce ".js"), ".scss" (will produce ".css") at their respective paths. Is this possible to do with Webpack? Sorry for asking this, but I couldn't find any answer to my question and yet I don't really know if the Webpack is the right tool for my project. Thanks in advance for your help.
The text was updated successfully, but these errors were encountered: