Skip to content

re-enable embroider-optimized#413

Draft
NullVoxPopuli wants to merge 4 commits intoember-cli:masterfrom
NullVoxPopuli:bah
Draft

re-enable embroider-optimized#413
NullVoxPopuli wants to merge 4 commits intoember-cli:masterfrom
NullVoxPopuli:bah

Conversation

@NullVoxPopuli
Copy link
Contributor

No description provided.

@@ -0,0 +1,38 @@
import { helper } from '@ember/component/helper';

import config from 'ember-get-config';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can avoid using ember-get-config by making this a class-based helper and resolving the config ourselves.

@aklkv
Copy link

aklkv commented Sep 3, 2025

👋 I was wondering if this would make sense to move this forward, i was thinking to convert this addon to v2 🤔

@mansona
Copy link
Member

mansona commented Sep 4, 2025

This addon doesn't provide that much value and has been removed from the v2 addon blueprint because of that. v2 addons that reach into the app for any reason are almost by definition a bad architecture when thinking about more modern package approaches 😞

Is there a usecase where a v2 addon version of this would make sense? I feel like this functionality would be better placed in a build plugin 🤔

@aklkv
Copy link

aklkv commented Sep 4, 2025

I am mainly going of what we have currently and it's breaking on Vite build, a welcome alternatives (though I have not looked for alternatives myself yet)

@NullVoxPopuli
Copy link
Contributor Author

Are you making active use of this library?

If not, i wouldn't look for a replacement.

However! I do find stuff like:
https://github.com/yjl9903/unplugin-info

Useful

@MichalBryxi
Copy link

MichalBryxi commented Jan 14, 2026

I can confirm that unplugin-info does work in embroider+vite project:

// package.json

{
  "devDependnencies": {
    "unplugin-info": "^1.2.4"
  }
}
// vite.config.mjs

import Info from 'unplugin-info/vite';

export default defineConfig({
  plugins: [
    Info(),
  ]
});
// app/templates/application.gts

import Component from '@glimmer/component';
import { sha } from '~build/git';

export default class Application extends Component<MyRouteSignature> {
  constructor(owner, args) {
    super(owner, args);
    console.log(`App Version: ${sha}`); // Just for demo purposes, don't do this at home kids!
  }

  <template>
    {{outlet}}
  </template>
}

@Windvis
Copy link

Windvis commented Feb 5, 2026

unplugin-info also works for Embroider + Webpack apps with the following config:

// ember-cli-build.js
const { Webpack } = require('@embroider/webpack');
return require('@embroider/compat').compatBuild(app, Webpack, {
  // other options
  packagerOptions: {
    webpackConfig: {
      plugins: [
        require('unplugin-info/webpack')()
      ]
    }
  }
});

I also tried it in a classic app by configuring ember-auto-import like this:

  const app = new EmberApp(defaults, {
    autoImport: {
      webpack: {
        plugins: [
          require('unplugin-info/webpack')()
        ]
      },
    },
  });

But it doesn't work, which seems to be the same problem as embroider-build/ember-auto-import#617

It's a shame, otherwise we could have deprecated this addon and added a migration guide for the unplugin-info equivalent. I guess we could still point people in the right direction without a deprecation though?

Edit: In our app we simply display the version number as listed in the package.json file (without any git info) so we're just passing that from the environment.js file for now, which should work in classic apps as well. No extra deps required:

// config/environment.js
  const ENV = {
    // ...
    appVersion: require('../package.json').version,
    // ...
  };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants