How to use the react-scripts/config/paths.appHtml function in react-scripts

To help you get started, we’ve selected a few react-scripts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tadatuta / rewire-entry / src / index.js View on Github external
function getHtmlPlugin(bundle, isProd) {
    const opts = Object.assign({
      inject: true,
      template: paths.appHtml,
      // note: 2.x adds optimization with 'vendors' and 'runtime~bundle' in chunks
      chunks: ['vendors', 'runtime~' + bundle, bundle],
      filename: bundle + '.html',
    }, isProd ? { minify: Object.assign(defaultMinify, params.minify) } : {});

    return new HtmlWebpackPlugin(opts);
  }
github Talend / component-runtime / component-form / component-form-demo / src / main / frontend / webpack.config.js View on Github external
// Make sure to add the new loader(s) before the "file" loader.
        ],
      },
    ],
  },
  plugins: [
    // Makes some environment variables available in index.html.
    // The public URL is available as %PUBLIC_URL% in index.html, e.g.:
    // 
    // In production, it will be an empty string unless you specify "homepage"
    // in `package.json`, in which case it will be the pathname of that URL.
    new InterpolateHtmlPlugin(env.raw),
    // Generates an `index.html` file with the 
github ghondar / crassa / react-scripts-wrapper-paths.js View on Github external
const hasSlash = inputPath.endsWith('/')
  if(hasSlash && !needsSlash) return inputPath.substr(0, inputPath.length - 1)
  else if(!hasSlash && needsSlash) return `${inputPath}/`
  else return inputPath
}

function getServedPath(publicUrl) {
  const servedUrl = publicUrl ? url.parse(publicUrl).pathname : '/'

  return ensureSlash(servedUrl, true)
}

paths.dotenv = existsSync(appDotEnv) ? appDotEnv : paths.dotenv
paths.appPath = appRootPath + '/'
paths.appPublic = appPublic
paths.appHtml = appPublic + '/index.html'
paths.appBuild = appBuild
paths.appPackageJson = appPackage
paths.yarnLockFile = appRootPath + '/yarn.lock'
paths.appSrc = appSrc
paths.appIndexJs = appSrc + '/index.js'
paths.proxySetup = appSrc + '/setupProxy.js'
paths.testsSetup = appSrc + '/setupTests'
paths.appNodeModules = appNodeModules
paths.servedPath = homepage ? getServedPath(homepage) : '/'
paths.publicUrl = homepage || ''

module.exports = paths
github layerssss / localhostd / bin / ui_build.js View on Github external
    filter: file => file !== paths.appHtml
  });
github goblin-laboratory / cra-multi-page-template / config-overrides.js View on Github external
removeComments: true,
    collapseWhitespace: true,
    removeRedundantAttributes: true,
    useShortDoctype: true,
    removeEmptyAttributes: true,
    removeStyleLinkTypeAttributes: true,
    keepClosingSlash: true,
    minifyJS: {
      comments: '@cc_on',
    },
    minifyCSS: true,
    minifyURLs: true,
  };
  const config = Object.assign(
    {},
    { inject: true, template: paths.appHtml },
    'development' !== env ? { minify } : undefined,
  );
  return entry => {
    return new HtmlWebpackPlugin({
      ...config,
      chunks: ['vendors', `runtime~${entry}.html`, entry],
      filename: `${entry}.html`,
    });
  };
};
github goblin-laboratory / cra-multi-page-template / react-app-rewire-entry.js View on Github external
const createHtmlWebpackPlugin = (entryName, env) => {
  const config = {
    inject: true,
    template: paths.appHtml,
    chunks: ['vendors', `runtime~${entryName}`, entryName],
    filename: `${entryName}.html`,
  };
  if ('development' === env) {
    return new HtmlWebpackPlugin(config);
  } else {
    return new HtmlWebpackPlugin({
      ...config,
      minify: {
        removeComments: true,
        collapseWhitespace: true,
        removeRedundantAttributes: true,
        useShortDoctype: true,
        removeEmptyAttributes: true,
        removeStyleLinkTypeAttributes: true,
        keepClosingSlash: true,