Skip to content

Commit 9a50de2

Browse files
committed
Optimize webpack config
1 parent 12ddb7e commit 9a50de2

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

packages/graphpack/config/webpack.config.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ const nodeExternals = require('webpack-node-externals');
66
const IS_DEV = process.env.NODE_ENV !== 'production';
77

88
module.exports = {
9+
devtool: 'sourcemap',
910
entry: {
10-
// We take care of setting up the server under ./server.js
11+
// We take care of setting up entry file under lib/server.js
1112
index: ['graphpack'],
1213
},
1314
// When bundling with Webpack for the backend you usually don't want to bundle
@@ -40,21 +41,28 @@ module.exports = {
4041
},
4142
],
4243
},
44+
node: {
45+
__filename: true,
46+
__dirname: true,
47+
},
4348
optimization: { noEmitOnErrors: true },
4449
output: {
4550
filename: '[name].js',
4651
libraryTarget: 'commonjs2',
4752
path: path.join(process.cwd(), './build'),
4853
sourceMapFilename: '[name].map',
4954
},
55+
performance: {
56+
hints: false,
57+
},
5058
plugins: [
5159
new webpack.optimize.LimitChunkCountPlugin({ maxChunks: 1 }),
5260
new webpack.EnvironmentPlugin({
5361
DEBUG: false,
5462
GRAPHPACK_SRC_DIR: path.resolve(process.cwd(), 'src'),
5563
NODE_ENV: 'development',
5664
}),
57-
new FriendlyErrorsWebpackPlugin(),
65+
new FriendlyErrorsWebpackPlugin({ clearConsole: IS_DEV }),
5866
],
5967
stats: 'minimal',
6068
target: 'node',

0 commit comments

Comments
 (0)