Webpack输出到内存,而不是将文件写入磁盘

问题描述

我正在使用Webpack捆绑我的React SSR应用程序。我在运行时而不是在构建时构建捆绑包

const compiler = webpack({
        mode: "development",// "production" | "development" | "none"
        module: {
            rules: [
                {
                    test: /\.jsx?$/,loader: 'babel-loader',query: {
                        presets: [
                            '@babel/preset-env','@babel/preset-react'
                        ]
                    },}
            ]
        },// name: 'main',target: 'web',entry: [
            path.resolve(__dirname,"./../../","components.js"),path.resolve(__dirname,"lib","components","hydrate.js")
        ],output: {
            path: path.resolve(__dirname,"./../../"),filename: 'bundle.js',}
    },(err,stats) => {
        if (err || stats.hasErrors()) {
            // Handle errors here
        } else {
            //run();
        }
    })

问题是我想捕获输出并将其保存在内存中,而不是将捆绑文件写入磁盘,因为我在每个新请求上都需要一个新捆绑。那有可能吗?

非常感谢您的帮助

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)