localFs.mkdirp(options.path, mkdirCallback);
^
TypeError: localFs.mkdirp is not a function
const path = require("path");
const resolve = require("path").resolve;
const HtmlWebpackPlugin = require("html-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const NodePolyfillPlugin = require("node-polyfill-webpack-plugin");
const AssetsPlugin = require("assets-webpack-plugin");
const runEnv = process.env.NODE_ENV || "development";
module.exports = {
entry: "./src/index.tsx",
output: {
path: resolve(__dirname, "dist"),
filename: runEnv === "production" ? "[name].[hash].js" : "bundle.js",
publicPath: runEnv === "production" ? "/request" : "/",
},
target: "web",
mode: runEnv,
devtool: runEnv === "production" ? "cheap-source-map" : "eval-source-map",
devServer: {
contentBase: path.join(__dirname, "dist"),
port: 3003,
historyApiFallback: true,
openPage: "/request",
hot: true,
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"],
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: "babel-loader",
exclude: /node_modules/,
},
{
test: /\.svg$/,
use: ["@svgr/webpack", "url-loader"],
},
{
test: /\.(png|pdf|jpg|eot|woff|woff2|ttf|gif)$/,
oneOf: [
{
loader: "url-loader",
options: {
limit: 9000,
},
},
],
},
],
},
plugins: [
new HtmlWebpackPlugin({
filename: "index.html",
template: "src/index.html",
excludeChunks: ["server"],
}),
new CopyPlugin({
patterns: [
{
from: "./src/_assets",
to: "assets",
},
],
}),
new NodePolyfillPlugin(),
new AssetsPlugin({
filename: "bundlePath.json",
fullPath: false,
path: path.join(__dirname, "dist"),
includeAllFileTypes: false,
fileTypes: ["js"],
keepInMemory: true,
}),
],
};
Describe the bug
On line 51 of
lib/output/createOutputWriter.jsthe local variablelocalFsis either filestream or the fs module from Node, but on line 88 the methodlocalFs.mkdirpis called to output the json file. The resulting error during a build is below.Changing this to
localFs.mkdirseems to fix the issue.To Reproduce
Steps to reproduce the behavior:
options.keepInMemorytotrueExpected behavior
For the JSON file to be output correctly in memory.
Webpack Config
Desktop (please complete the following information):
Additional context
Add any other context about the problem here.