How to use @embroider/compat - 8 common examples

To help you get started, we’ve selected a few @embroider/compat 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 embroider-build / embroider / test-packages / macro-sample-addon / ember-cli-build.js View on Github external
let app = new EmberAddon(defaults, {
    // Add options here
  });

  /*
    This build file specifies the options for the dummy test app of this
    addon, located in `/tests/dummy`
    This build file does *not* influence how the addon or the app using it
    behave. You most likely want to be modifying `./index.js` or app's build file
  */

  if (process.env.CLASSIC) {
    return app.toTree();
  }
  const Webpack = require('@embroider/webpack').Webpack;
  return require('@embroider/compat').compatBuild(app, Webpack);
};
github embroider-build / embroider / test-packages / engines-host-app / ember-cli-build.js View on Github external
// If you need to use different assets in different
  // environments, specify an object as the first parameter. That
  // object's keys should be the environment name and the values
  // should be the asset to use in that environment.
  //
  // If the library that you are including contains AMD or ES6
  // modules that you would like to import into your application
  // please specify an object with the list of modules as keys
  // along with the exports of each module as its value.

  if (process.env.CLASSIC) {
    return app.toTree();
  }

  const Webpack = require('@embroider/webpack').Webpack;
  return require('@embroider/compat').compatBuild(app, Webpack);
};
github embroider-build / embroider / packages / router / ember-cli-build.js View on Github external
module.exports = function(defaults) {
  let app = new EmberAddon(defaults, {
    // Add options here
  });

  if (process.env.CLASSIC) {
    return app.toTree();
  }

  const Webpack = require('@embroider/webpack').Webpack;
  return require('@embroider/compat').compatBuild(app, Webpack, {
    staticAddonTestSupportTrees: true,
    staticAddonTrees: true,
    staticComponents: true,
    staticHelpers: true,
    splitRouteClasses: true,
    splitAtRoutes: ['split-me'],
  });
};
github embroider-build / embroider / test-packages / macro-tests / ember-cli-build.js View on Github external
app.import('vendor/three.js', { outputFile: 'ordered.js' });
  app.import('vendor/one.js', { outputFile: 'ordered.js' });

  app.import('vendor/prepend/one.js', { prepend: true });
  app.import('vendor/prepend/two.js', { prepend: true });
  app.import('vendor/prepend/three.js', { prepend: true });
  app.import('vendor/prepend/four.js', { prepend: true });

  app.import('vendor/prepend/order.js', { prepend: true });

  if (process.env.CLASSIC) {
    return app.toTree();
  }

  const Webpack = require('@embroider/webpack').Webpack;
  return require('@embroider/compat').compatBuild(app, Webpack);
};
github embroider-build / embroider / test-packages / static-app / ember-cli-build.js View on Github external
module.exports = function(defaults) {
  let app = new EmberApp(defaults, {});

  MacrosConfig.shared().setOwnConfig(__filename, {
    isClassic: Boolean(process.env.CLASSIC),
  });

  if (process.env.CLASSIC) {
    return app.toTree();
  }

  const Webpack = require('@embroider/webpack').Webpack;
  return require('@embroider/compat').compatBuild(app, Webpack, {
    workspaceDir: process.env.WORKSPACE_DIR,
    staticAddonTestSupportTrees: true,
    staticAddonTrees: true,
    staticComponents: true,
    staticHelpers: true,
    packageRules: [
      {
        package: 'static-app',
        appModules: {
          'components/fancy-box.js': {
            dependsOnComponents: ['{{default-title}}'],
          },
        },
        components: {
          '{{fancy-box}}': {
            acceptsComponentArguments: [{ name: 'titleComponent', becomes: 'this.titleComponentWithDefault' }],
github embroider-build / embroider / test-packages / support / build.ts View on Github external
static async build(project: Project, params: Partial) {
    MacrosConfig.reset();
    let paramsWithDefaults: BuildParams = Object.assign({}, params, defaultParams);
    project.writeSync();
    let instance;
    if (paramsWithDefaults.type === 'addon') {
      instance = emberAddon(project.baseDir, params.emberAppOptions);
    } else {
      instance = emberApp(project.baseDir, params.emberAppOptions);
    }
    let addons = new Addons(instance, params.embroiderOptions);
    let tree;
    if (params.stage === 1) {
      tree = addons.tree;
    } else {
      let compatApp = new App(instance, addons, params.embroiderOptions);
      tree = compatApp.tree;
    }
    let builder = new Builder(tree);
    let builderPromise = builder.build();
    let results = await Promise.all([builderPromise, addons.ready()]);
    let basePath = results[1].outputPath;
    return new BuildResult(project, basePath, builder);
  }
  private constructor(private project: Project, public outputPath: string, private builder: Builder) {
github embroider-build / embroider / test-packages / support / build.ts View on Github external
static async build(project: Project, params: Partial) {
    MacrosConfig.reset();
    let paramsWithDefaults: BuildParams = Object.assign({}, params, defaultParams);
    project.writeSync();
    let instance;
    if (paramsWithDefaults.type === 'addon') {
      instance = emberAddon(project.baseDir, params.emberAppOptions);
    } else {
      instance = emberApp(project.baseDir, params.emberAppOptions);
    }
    let addons = new Addons(instance, params.embroiderOptions);
    let tree;
    if (params.stage === 1) {
      tree = addons.tree;
    } else {
      let compatApp = new App(instance, addons, params.embroiderOptions);
      tree = compatApp.tree;
    }
    let builder = new Builder(tree);
    let builderPromise = builder.build();
    let results = await Promise.all([builderPromise, addons.ready()]);
    let basePath = results[1].outputPath;
    return new BuildResult(project, basePath, builder);
  }
  private constructor(private project: Project, public outputPath: string, private builder: Builder) {
github cardstack / cardstack / packages / cardhost / ember-cli-build.js View on Github external
return (function() {
    const Webpack = require('@embroider/webpack').Webpack;
    const { join } = require('path');
    const { writeFileSync } = require('fs');

    return require('@embroider/compat').compatBuild(app, Webpack, {
      staticAddonTestSupportTrees: true,
      staticAddonTrees: true,
      staticHelpers: true,
      staticComponents: true,
      onOutputPath(outputPath) {
        writeFileSync(join(__dirname, '.embroider-app-path'), outputPath, 'utf8');
      },
      packagerOptions: {
        webpackConfig: {
          plugins: [new MonacoWebpackPlugin(/*{languages: ['javascript', 'typescript']}*/)],
        },
      },
      packageRules: [
        {
          package: '@cardstack/core',
          appModules: {

@embroider/compat

Backward compatibility layer for the Embroider build system.

MIT
Latest version published 8 days ago

Package Health Score

81 / 100
Full package analysis

Similar packages