Answer the question
In order to leave comments, you need to log in
How to solve the webpack build issue “This is probably not a problem with npm. There is likely additional logging output above."?
// webpack.config.js
const path = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const TsconfigPathsPlugin = require("tsconfig-paths-webpack-plugin");
const webpack = require("webpack")
const isDev = process.env.WEBPACK_MODE === "development";
const isProd = !isDev;
module.exports = {
entry: "./src/index.tsx",
output: {
filename: "script.js",
path: path.join(__dirname, "dist"),
publicPath: "/",
},
plugins: [
new TsconfigPathsPlugin({ configFile: "./tsconfig.json" }),
new MiniCssExtractPlugin(),
new HtmlWebpackPlugin({
template: './src/index.html',
minify: isProd
}),
new webpack.ProvidePlugin({
process: 'process/browser',
}),
new CleanWebpackPlugin()
],
resolve: {
extensions: [".js", ".ts", ".tsx"],
fallback: {
crypto: require.resolve("crypto-browserify"),
"stream": require.resolve("stream-browserify")
},
alias: {
process: "process/browser"
}
},
devServer: {
port: 3000,
hot: isDev,
historyApiFallback: true,
},
// optimization: optimization(),
module: {
rules: [
{
test: /\.(js|tsx?)$/,
exclude: [/node_modules/],
use: {
loader: "ts-loader",
},
},
{
test: /\.css/,
exclude: [/node_modules/],
use: [MiniCssExtractPlugin.loader, "css-loader"],
},
],
},
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question