How to use the fuse-box.JSONPlugin 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 bkniffler / debe / example / todo / fuse.ts View on Github external
});

  // start the hot reload server
  if (!isProduction) {
    fuse.dev({
      fallback: '../src/index.html',
      port: DEV_PORT
    });
  }

  // bundle the electron renderer code
  const browser = fuse
    .bundle('browser')
    .target('browser@esnext')
    .instructions('> example/todo/src/index.tsx')
    .plugin(JSONPlugin())
    .plugin(WebIndexPlugin({ template: './src/index.html' }))
    .plugin(CSSPlugin({ inject: true }))
    .plugin(
      ReplacePlugin({
        'process.env.NODE_ENV': `${process.env.NODE_ENV}`
      })
    );

  const server = fuse
    .bundle('server')
    .target('server@esnext')
    .instructions('> example/todo/server/index.ts -better-sqlite3');

  if (!isProduction) {
    server.watch(
      p =>
github fliphub / fliphub / packages / fliphub / src / presets / DefaultsFuseBox.js View on Github external
entry = entry.replace('./', '').replace(root, '')
    }

    // this.args &&
    if (typeof output === 'string') {
      output = output
        .replace('./', '')
        .replace(root, '')
        .replace('[name]', '$name')
    }

    // log.quick(this.args, instructions, root, workflow)
    // log.quick({entry, output})

    return {
      plugins: [HTMLPlugin({default: true}), JSONPlugin()],
      entry,
      output,
    }
  }
}
github sentialx / multrin / fuse.js View on Github external
const renderer = (name, port) => {
  const cfg = getRendererConfig('electron', name);

  cfg.plugins.push(getWebIndexPlugin(name));
  cfg.plugins.push(JSONPlugin());
  cfg.plugins.push(getCopyPlugin());
  cfg.plugins.push(StyledComponentsPlugin());

  const fuse = FuseBox.init(cfg);

  if (!production) {
    fuse.dev({ httpServer: true, port, socketURI: `ws://localhost:${port}` });
  }

  const app = fuse.bundle(name).instructions(`> [renderer/${name}/index.tsx]`);

  if (!production) {
    app.hmr({ port, socketURI: `ws://localhost:${port}` }).watch();

    if (name === 'app') {
      return fuse.run().then(() => {
github wexond / desktop / fuse.js View on Github external
const renderer = name => {
  const cfg = getRendererConfig('electron');

  cfg.plugins.push(getWebIndexPlugin(name));

  cfg.plugins.push(JSONPlugin());
  cfg.plugins.push(getCopyPlugin());
  cfg.plugins.push(StyledComponentsPlugin());

  const fuse = FuseBox.init(cfg);

  let instructions = `> [renderer/views/${name}/index.tsx]`;

  if (production) {
    instructions = `> renderer/views/${name}/index.tsx -node-vibrant -electron -electron-extensions -styled-components -node-bookmarks-parser`;
  }

  const app = fuse.bundle(name).instructions(instructions);

  if (!production) {
    if (name === 'app') {
      fuse.dev({ httpServer: true });
github dot-browser / desktop / fuse.js View on Github external
const web = name => {
  const cfg = getWebConfig(name);

  cfg.plugins.push(getWebIndexPlugin(name));
  cfg.plugins.push(JSONPlugin());
  cfg.plugins.push(getCopyPlugin());
  cfg.plugins.push(StyledComponentsPlugin());

  const fuse = FuseBox.init(cfg);

  const app = fuse
    .bundle(name)
    .instructions(`> renderer/externals/${name}/index.tsx`);

  app.hmr({ reload: true }).watch();
  fuse.run();
};
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,
      },
      alias: {
        '@ui': '~/src/',
github qusly / qusly / fuse.js View on Github external
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,
            },
          }),
      ].concat(plugins),
      alias: {
        '~': '~/',
        '@renderer': '~/renderer/',
      },
      log: {
        showBundledFiles: false,