const path = require('path');
const webpack = require('webpack');
const pkg = require('../package.json');

module.exports = (config, options) => {
  config.plugins.push(
    new webpack.DefinePlugin({
      APP_VERSION: JSON.stringify(pkg.version)
    })
  );

  config.resolve.alias = {
    ...config.resolve.alias,
    '@totopia-scss/ui': path.resolve(
      __dirname,
      '..',
      'projects/ui/assets/scss'
    ),
    '@totopia-scss/ui-game': path.resolve(
      __dirname,
      '..',
      'projects/ui-game/assets/scss'
    ),
    '@totopia-scss/ui-information': path.resolve(
      __dirname,
      '..',
      'projects/ui-information/assets/scss'
    ),
    '@totopia-scss/ui-money': path.resolve(
      __dirname,
      '..',
      'projects/ui-money/assets/scss'
    ),
    '@totopia-scss/ui-site': path.resolve(
      __dirname,
      '..',
      'projects/ui-site/assets/scss'
    ),
    '@totopia-scss/ui-special': path.resolve(
      __dirname,
      '..',
      'projects/ui-special/assets/scss'
    ),
    '@totopia-scss/ui-user': path.resolve(
      __dirname,
      '..',
      'projects/ui-user/assets/scss'
    )
  };

  return config;
};
