Repository URL to install this package:
|
Version:
1.3.8 ▾
|
@skava/graphql
/
webpack.config.prod.js
|
|---|
const path = require('path')
const nodeExternals = require('webpack-node-externals')
const webpack = require('webpack')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
// process.env.NODE_ENV = 'production'
module.exports = () => {
return {
target: 'node',
// devtool: 'inline-source-map',
devtool: 'none',
mode: 'production',
/**
* @NOTE - THIS IS DIFFERENT THAN DEV - WE EXPORT ONLY THE APP
*/
entry: './src/app.ts',
output: {
/**
* @todo prod build for commonjs in a different file - export 2 webpack configs
*/
// libraryTarget: process.env.IS_STANDALONE_GRAPHQL ? 'var' : 'commonjs',
libraryTarget: 'commonjs',
path: path.resolve('./dist'),
filename: 'server.js',
},
externals: nodeExternals(),
module: {
rules: [
{
// exclude: /node_modules/,
test: /\.graphql$/,
use: [{ loader: 'graphql-import-loader' }],
},
{
test: /\.t|jsx?$/,
// exclude: /node_modules/,
use: [
{
loader: require.resolve('ts-loader'),
options: {
// disable type checker - we will use it in fork plugin
transpileOnly: true,
// https://github.com/TypeStrong/ts-loader#ignorediagnostics-number-default
},
},
// options: {cacheDirectory: true},
],
},
],
},
resolve: {
mainFields: ['main', 'module'],
extensions: ['.js', '.ts', '.json'],
},
}
}