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
Get bundle as a string with programmatically usage with 0.6.x #23
Comments
yes. There is an option Here is a working example: https://github.com/webpack/worker-loader/blob/master/index.js It's a webpack loader which compiles to WebWorker. Good luck. |
The API which returns the source in the callback was deprecated in webpack 0.5 and I removed it in 0.6. The reason for removing was that many loader would not work with the old API because they emit files. I. e. The webpack-dev-middleware also do webpack in memory: https://github.com/webpack/webpack-dev-middleware/blob/master/middleware.js#L15 |
Thank you for your fast response. I'm not sure if I got it, but are the following steps correct?
|
Set output to the name of the bundled file, i. e. You don't need the "bundle" event just use the callback in third. webpack(absoluteFile, {
output: "bundle.js",
noWrite: true,
emitFile: function(name, stringOrBuffer) {
files[name] = stringOrBuffer;
}
}, function(err, stats) {
if(err) return handleError(err);
processFiles(files);
}) |
Thank you again for your fast response and help. It works now. If you like to you can take a look my implementation here: WebpackBundler |
How to do this with webpack 1.x or later? Only possible with memory file system, e.g. https://webpack.github.io/docs/node.js-api.html#compile-to-memory? Or custom read from filesystem after compile? |
We're using for alamid's client tests nof5.
nof5 is basically a server which is able to use different bundlers, e.g. webpack, to bundle and serve client tests. One advantage of nof5 is that there is no need to write any tmp-file for the tests. So you won't have any problems with permissions.
So nof5 expects from the bundlers to be able to return a bundle as a string.
This is how webpack is implemented as bundler for nof5: WebpackBundler.
I wanted to updated the dependecy to webpack to version 0.6.x, but webpack isn't return a string any more.
Is there any possibility to get the bundle as string?
The text was updated successfully, but these errors were encountered: