How to use the fuse-box.EnvPlugin function in fuse-box

To help you get started, we’ve selected a few fuse-box 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 OffGridNetworks / fuse-box-create-react-app / packages / fuse-box-react-scripts-ts / config / fuse.config.js View on Github external
Sparky.task('config', () => {
    fuse = new FuseBox({
      homeDir: srcDir,
      sourceMaps: isProduction ? false : { project: true, vendor: false },
      hash: isProduction && !component && !componentdocs,
      cache: !isProduction,
      output: path.join(
        targetDir,
        componentdocs ? paths.Bundle : '',
        '$name.js'
      ),
      target: isProduction ? 'browser@es5' : 'browser@es2015',
      plugins: [
        EnvPlugin(env),
        SVGPlugin(),
        /* [LESSPlugin(), CSSPlugin()],  Add LESS, SASS, etc here if needed */
        CSSPlugin(),
        JSONPlugin(),
        !component &&
          !componentdocs &&
          WebIndexPlugin({
            template: path.join(srcDir, 'index.html'),
            path: './',
          }),
        isProduction &&
          !component &&
          !componentdocs &&
          QuantumPlugin({ removeExportsInterop: false, uglify: true }),
      ],
    });
github OffGridNetworks / fuse-box-create-react-app / packages / fuse-box-react-scripts / config / fuse.config.js View on Github external
Sparky.task('config', () => {
    fuse = new FuseBox({
      homeDir: srcDir,
      sourceMaps: isProduction ? false : { project: true, vendor: false },
      hash: isProduction && !component && !componentdocs,
      cache: !isProduction,
      output: path.join(
        targetDir,
        componentdocs ? paths.Bundle : '',
        '$name.js'
      ),
      target: isProduction ? 'browser@es5' : 'browser@es2015',
      plugins: [
        EnvPlugin(env),
        SVGPlugin(),
        /* [LESSPlugin(), CSSPlugin()],  Add LESS, SASS, etc here if needed */
        CSSPlugin(),
        JSONPlugin(),
        WebIndexPlugin({
          template: path.join(srcDir, 'index.html'),
          path: './',
        }),
        BabelPlugin(exports.babelConfig({ paths })),
        isProduction &&
          QuantumPlugin({ removeExportsInterop: false, uglify: true }),
      ],
    });

    vendor = fuse.bundle('vendor').instructions('~ index.js');
    app = fuse.bundle('app').instructions('!> [index.js]');
github patrickmichalina / fusing-angular / tools / runner / bundle.ts View on Github external
const electronVars = Object
    .keys(process.env)
    .filter(k => k.includes('NG_'))
    .reduce((acc, curr) => ({ ...acc, [curr.replace('NG_', '')]: process.env[curr] }), {
      NG_SERVER_HOST: `http://localhost:${UNIVERSAL_PORT}`
    })

  const electron = FuseBox.init({
    ...shared,
    sourceMaps: false,
    target: 'electron',
    output: `${opts.outputDirectory}/${'electron'}/$name.js`,
    ignoreModules: opts.electron.bundle.ignoredModules,
    plugins: [
      EnvPlugin(electronVars)
    ]
  })

  browser
    .bundle(opts.vendorBundleName)
    .instructions(` ~ ${browserEntry}`)

  electronBrowser
    .bundle(opts.vendorBundleName)
    .instructions(` ~ ${electronBrowserEntry}`)

  const electronBrowserBundle = electronBrowser
    .bundle(opts.browser.bundle.name)
    .splitConfig({ dest: opts.jsLazyModuleDir, browser: `/${opts.jsOutputDir}/` })
    .instructions(` !> [${electronBrowserEntry}]`)
github patrickmichalina / fusebox-angular-universal-starter / fuse.ts View on Github external
target: "universal",
      warnings: false,
      uglify: true,
      treeshake: true,
      bakeApiIntoBundle: vendorBundleName,
      processPolyfill: true
    })
  ]
}

const serverOptions = {
  ...baseOptions,
  target: 'server',
  sourceMaps: false,
  plugins: [
    EnvPlugin(ENV_CONFIG_INSTANCE),
    ...baseOptions.plugins
  ]
}

Sparky.task('build.universal', () => {
  const fuseApp = FuseBox.init(appOptions as any);
  const fuseServer = FuseBox.init(serverOptions as any);
  const path = isAot ? 'client/.aot/src/client/app' : 'client/app';
  const serverBundle = fuseServer.bundle('server').instructions(serverBundleInstructions);
  const vendorBundle = fuseApp.bundle(`${vendorBundleName}`).instructions(vendorBundleInstructions)
  const appBundle = fuseApp
    .bundle(appBundleName)
    .splitConfig({ dest: 'js/modules' })
    .instructions(`${appBundleInstructions} + [${path}/**/!(*.spec|*.e2e-spec|*.ngsummary|*.snap).*]`)

  if (!isBuildServer && !argv['build-only']) {
github qusly / qusly / fuse.js View on Github external
static getFuseConfig(target, name, output = '$name.js', plugins = []) {
    const { HOSTNAME, USER, PASSWORD, PROTOCOL, PORT, ENABLED } = process.env;

    return {
      target,
      homeDir: 'src/',
      output: join(outputDir, output),
      tsConfig: './tsconfig.json',
      useTypescriptCompiler: true,
      sourceMaps: !production,
      cache: !production,
      plugins: [
        EnvPlugin({
          NODE_ENV: production ? 'production' : 'development',
          HOSTNAME,
          USER,
          PASSWORD,
          PROTOCOL,
          PORT,
          ENABLED,
        }),
        JSONPlugin(),
        production &&
          QuantumPlugin({
            bakeApiIntoBundle: name,
            treeshake: true,
            removeExportsInterop: false,
            uglify: {
              es6: true,
github wexond / wexond-ui / fuse.js View on Github external
static getFuseConfig(target, name, output = '$name.js', plugins = []) {
    return {
      target,
      homeDir: './',
      output: join(outputDir, output),
      tsConfig: './tsconfig.json',
      useTypescriptCompiler: true,
      cache: !production,
      plugins: [
        EnvPlugin({
          NODE_ENV: production ? 'production' : 'development',
        }),
        JSONPlugin(),
        production &&
          QuantumPlugin({
            bakeApiIntoBundle: name,
            treeshake: true,
            removeExportsInterop: false,
            uglify: {
              es6: true,
            },
          }),
      ].concat(plugins),
      log: {
        showBundledFiles: false,
        clearTerminalOnBundle: true,