<commit_before>import 'angular2-universal-polyfills';

var webpack = require('webpack');
var path = require('path');
var clone = require('js.clone');

var UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
var DedupePlugin = require('webpack/lib/optimize/DedupePlugin');
var ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
var TsConfigPathsPlugin = require('awesome-typescript-loader').TsConfigPathsPlugin;
var ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;

import { UniversalPrerender } from 'angular2-webpack-prerender';
import { MainModule } from './src/main.node';
debugger

var sharedPlugins = [
  // new DedupePlugin(),
  // new UglifyJsPlugin({
  //   // beautify: true, //debug
  //   // mangle: false, //debug
  //   // mangle: true, //prod
  //   compress: {
  //     screw_ie8: true,
  //     keep_fnames: true,
  //     // drop_debugger: false,
  //     // dead_code: true,
  //     // unused: true
  //   },
  //   comments: false,
  // }),
  new ContextReplacementPlugin(
    // The (\\|\/) piece accounts for path separators in *nix and Windows
    /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
    root('./src')
  ),
  new TsConfigPathsPlugin({
    tsconfig: 'tsconfig.json'
  }),
  new ForkCheckerPlugin(),
  new UniversalPrerender({
    ngModule: MainModule,
    documentPath: `
<!doctype>
<html lang="en">
<head>
  <title>Angular 2 Universal Starter</title>
  <meta charset="UTF-8">
  <meta name="description" content="Angular 2 Universal">
  <meta name="keywords" content="Angular 2,Universal">
  <meta name="author" content="PatrickJS">

  <link rel="icon" href="data:;base64,iVBORw0KGgo=">

  <base href="/">
<body>
  <div style="position: absolute;z-index: 1000000;bottom: 9px">
    <button onclick="bootstrap()">Bootstrap Client</button>
    <button onclick="location.reload()">Reload Client</button>
  </div>

  <app>
    Loading...
  </app>

  <script src="dist/public/browser-bundle.js"></script>
</body>
</html>
    `,
    time: true,
    originUrl: 'http://localhost:3000',
    baseUrl: '/',
    requestUrl: '/',
    // preboot: false,
    preboot: { appRoot: ['app'], uglify: true },
  })
];
var webpackConfig = setTypeScriptAlias(require('./tsconfig.json'), {
  cache: true,

  devtool: 'source-map',

  output: {
    filename: '[name]-bundle.js',
    path: './dist',
  },

  module: {
    preLoaders: [
      // fix angular2
      {
        test: /(systemjs_component_resolver|system_js_ng_module_factory_loader)\.js$/,
        loader: 'string-replace-loader',
        query: {
          search: '(lang_1(.*[\\n\\r]\\s*\\.|\\.))?(global(.*[\\n\\r]\\s*\\.|\\.))?(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import',
          replace: 'System.import',
          flags: 'g'
        }
      },<commit_msg>chore(webpack): provide document and path<commit_after>import 'angular2-universal-polyfills';

var webpack = require('webpack');
var path = require('path');
var clone = require('js.clone');

var UglifyJsPlugin = require('webpack/lib/optimize/UglifyJsPlugin');
var DedupePlugin = require('webpack/lib/optimize/DedupePlugin');
var ContextReplacementPlugin = require('webpack/lib/ContextReplacementPlugin');
var TsConfigPathsPlugin = require('awesome-typescript-loader').TsConfigPathsPlugin;
var ForkCheckerPlugin = require('awesome-typescript-loader').ForkCheckerPlugin;

import { UniversalPrerender } from 'angular2-webpack-prerender';
import { MainModule } from './src/main.node';
debugger

var sharedPlugins = [
  // new DedupePlugin(),
  // new UglifyJsPlugin({
  //   // beautify: true, //debug
  //   // mangle: false, //debug
  //   // mangle: true, //prod
  //   compress: {
  //     screw_ie8: true,
  //     keep_fnames: true,
  //     // drop_debugger: false,
  //     // dead_code: true,
  //     // unused: true
  //   },
  //   comments: false,
  // }),
  new ContextReplacementPlugin(
    // The (\\|\/) piece accounts for path separators in *nix and Windows
    /angular(\\|\/)core(\\|\/)(esm(\\|\/)src|src)(\\|\/)linker/,
    root('./src')
  ),
  new TsConfigPathsPlugin({
    tsconfig: 'tsconfig.json'
  }),
  new ForkCheckerPlugin(),
  new UniversalPrerender({
    ngModule: MainModule,
    documentPath: 'index.html',
    document: `
<!doctype>
<html lang="en">
<head>
  <title>Angular 2 Universal Starter</title>
  <meta charset="UTF-8">
  <meta name="description" content="Angular 2 Universal">
  <meta name="keywords" content="Angular 2,Universal">
  <meta name="author" content="PatrickJS">

  <link rel="icon" href="data:;base64,iVBORw0KGgo=">

  <base href="/">
<body>
  <div style="position: absolute;z-index: 1000000;bottom: 9px">
    <button onclick="bootstrap()">Bootstrap Client</button>
    <button onclick="location.reload()">Reload Client</button>
  </div>

  <app>
    Loading...
  </app>

  <script src="dist/public/browser-bundle.js"></script>
</body>
</html>
    `,
    time: true,
    originUrl: 'http://localhost:3000',
    baseUrl: '/',
    requestUrl: '/',
    preboot: false,
    // preboot: { appRoot: ['app'], uglify: true },
  })
];
var webpackConfig = setTypeScriptAlias(require('./tsconfig.json'), {
  cache: true,

  devtool: 'source-map',

  output: {
    filename: '[name]-bundle.js',
    path: './dist',
  },

  module: {
    preLoaders: [
      // fix angular2
      {
        test: /(systemjs_component_resolver|system_js_ng_module_factory_loader)\.js$/,
        loader: 'string-replace-loader',
        query: {
          search: '(lang_1(.*[\\n\\r]\\s*\\.|\\.))?(global(.*[\\n\\r]\\s*\\.|\\.))?(System|SystemJS)(.*[\\n\\r]\\s*\\.|\\.)import',
          replace: 'System.import',
          flags: 'g'
        }
      },
{'fraction_non_alphanumeric': 0.1940928270042194, 'fraction_numerical': 0.008438818565400843, 'mean_word_length': 3.1046176046176046, 'pattern_counts': {'":': 0, '<': 51, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2212288', 'n_tokens_mistral': 1992, 'n_tokens_neox': 1897, 'n_words': 356}