// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/publicdomain/zero/1.0/

import webpack from 'webpack';
import path from 'path';
import defaultConfig from './webpack.base';
import * as Const from '../utils/const';
import { nodeExternals } from '../utils/webpack';

export const SRC_DIR = path.join(Const.SRC_DIR, 'services', 'content-service');
export const DST_DIR = path.join(Const.LIB_DIR, 'services', 'content-service');

export default {
  ...defaultConfig,
  entry: path.join(SRC_DIR, 'index.js'),
  output: {
    ...defaultConfig.output,
    path: DST_DIR,
    filename: 'index.js',
    sourceMapFilename: 'index.map',
    libraryTarget: 'commonjs',
  },
  target: 'node',
  plugins: [
    ...defaultConfig.plugins,
    new webpack.DefinePlugin({
      PROCESS_TYPE: '"content-service"',
    }),
    new webpack.DefinePlugin({
      LIBDIR: 'require("path").join(__dirname, "..", "..")',
    }),
  ],
  externals: [
    ...defaultConfig.externals,
    nodeExternals,
  ],
};

@@ -934,16 +934,208 @@
 ),%0A  %5D,%0A
+  resolve: %7B%0A    ...defaultConfig.resolve,%0A    alias: %7B%0A      ...defaultConfig.resolve.alias,%0A      'app/shared/environment': path.join(Const.SRC_DIR, 'shared', 'environment.js'),%0A    %7D,%0A  %7D,%0A
   extern

Use same webpack config for content service as main for resolving app/shared/environment for the logger to fix content service crash. (#1473)