<commit_before>import { Neutrino } from 'neutrino'
import merge from 'deepmerge'
import react from 'neutrino-preset-react'
import {
  env,
  ssr,
  betterOpen,
  extractStyle,
  html,
  minifyStyle,
} from './middlewares'
import { removeEntryPoints } from './utils'
import { Options } from './Options'

export default (neutrino: Neutrino, opts: Partial<Options> = {}) => {
  const options = merge<Options>(
    {
      devServer: {
        quiet: neutrino.options.quiet,
        noInfo: neutrino.options.quiet,
        port: 5000,
        https: false,
        open: true,
        stats: {
          errorDetails: false,
        },
      },
      hot: true,
      polyfills: {
        async: true,
      },
      tux: {
        admin: process.env.NODE_ENV !== 'production',
      },
      html: {},
    },
    opts as Options
  )
  neutrino.options.target = neutrino.options.target || 'browser'

  neutrino.use(react, merge<any>(options, { devServer: { open: false } }))
  neutrino.use(html, options.html)
  neutrino.use(env, options)

  neutrino.config
    .when(options.devServer.open, () => neutrino.use(betterOpen, options))
    .when(
      process.env.NODE_ENV === 'production',
      () => {
        neutrino.use(extractStyle)
        neutrino.use(minifyStyle)
      },
      config => {
        config
          .entry('index')<commit_msg>Use absolute paths by default<commit_after>import { Neutrino } from 'neutrino'
import merge from 'deepmerge'
import react from 'neutrino-preset-react'
import {
  env,
  ssr,
  betterOpen,
  extractStyle,
  html,
  minifyStyle,
} from './middlewares'
import { removeEntryPoints } from './utils'
import { Options } from './Options'

export default (neutrino: Neutrino, opts: Partial<Options> = {}) => {
  const options = merge<Options>(
    {
      devServer: {
        quiet: neutrino.options.quiet,
        noInfo: neutrino.options.quiet,
        port: 5000,
        https: false,
        open: true,
        stats: {
          errorDetails: false,
        },
      },
      hot: true,
      polyfills: {
        async: true,
      },
      tux: {
        admin: process.env.NODE_ENV !== 'production',
      },
      html: {},
    },
    opts as Options
  )
  // This preset depends on a target option, let's give it a default.
  neutrino.options.target = neutrino.options.target || 'browser'

  // Build on top of the offical react preset (overriding open functionality).
  neutrino.use(react, merge<any>(options, { devServer: { open: false } }))

  // Switch to custom html plugin.
  neutrino.use(html, options.html)

  // Add more environment variables.
  neutrino.use(env, options)

  neutrino.config// Neutrino defaults to relative paths './'. Tux is optimized for SPAs, where apsolute paths
  // are a better default.
  .output
    .publicPath('/')
    // Use a better open utility.
    .when(options.devServer.open, () => neutrino.use(betterOpen, options))
    .when(
      process.env.NODE_ENV === 'production',
      // Extract and minify stylesheets in production.
      () => {
        neutrino.use(extractStyle)
        neutrino.use(minifyStyle)
      },
      // Add better error handling in development.
      config => {
        config
          .entry('index')
{'fraction_non_alphanumeric': 0.1287620229599752, 'fraction_numerical': 0.0024821594787465093, 'mean_word_length': 2.4080338266384778, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '239621', 'n_tokens_mistral': 1013, 'n_tokens_neox': 989, 'n_words': 249}