Skip to content

Instantly share code, notes, and snippets.

@lmcarreiro
Last active June 5, 2019 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmcarreiro/599695c271576a001bc260f5eef9d9c5 to your computer and use it in GitHub Desktop.
Save lmcarreiro/599695c271576a001bc260f5eef9d9c5 to your computer and use it in GitHub Desktop.
Webpack error with multiple configurations and --info-verbosity verbose
console.log("client");
{
"name": "test-webpack",
"version": "1.0.0",
"description": "",
"scripts": {
"start:ok": "webpack",
"start:error": "webpack --info-verbosity verbose"
},
"devDependencies": {
"@types/node": "^12.0.4",
"@types/webpack": "^4.4.32",
"webpack": "^4.32.2",
"webpack-cli": "^3.3.2"
}
}
console.log("server");
// @ts-check
const webpack = require('webpack');
const path = require('path');
module.exports = [clientConfig, serverConfig];
function clientConfig(env) {
/** @type {webpack.Configuration} */
const config = {
entry: './index.js',
mode: env && env.prod ? 'production' : 'development',
target: 'web',
output: {
path: path.resolve(__dirname, 'build', 'static'),
filename: 'index.js',
},
resolve: {
extensions: ['.js'],
},
}
return config;
}
function serverConfig(env) {
/** @type {webpack.Configuration} */
const config = {
entry: './server.js',
mode: env && env.prod ? 'production' : 'development',
target: 'node',
output: {
path: path.resolve(__dirname, 'build'),
filename: 'server.js',
},
resolve: {
extensions: ['.js'],
},
}
return config;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment