Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

staticComponents misses sub-components with an unused parent #1747

Open
fdeters opened this issue Jan 2, 2024 · 1 comment
Open

staticComponents misses sub-components with an unused parent #1747

fdeters opened this issue Jan 2, 2024 · 1 comment

Comments

@fdeters
Copy link

fdeters commented Jan 2, 2024

When I was walking through enabling recommended Embroider options, I noticed that some components weren't making it into the build after I enabled staticComponents:

"Uncaught (in promise) Error: Attempted to resolve alert/taxlots-off, which was expected to be a component, but nothing was found."

I eventually narrowed down the issue to components that are defined in a subfolder that does not share a name with an existing component. For example, in the directory below, the taxlots-off component will not render (because there is no alert component), but the item component will render (because there is a tabs component).

app/
├─ components/
│  ├─ alert/
│  │  ├─ taxlots-off.gjs
│  ├─ tabs/
│  │  ├─ item.gjs
│  ├─ tabs.gjs

I tried creating an alert component, but nothing changed until I actually invoked the new alert component. When I added it just above the offending alert/taxlots-off component in the template, the error went away and everything rendered.

Ideally, components should make it into the build regardless of which subfolder they're in and whether or not they have a parent component in the directory (in my opinion).

Here are my potentially relevant package versions:

  • @embroider/compat 3.2.3
  • @embroider/core 3.3.0
  • @embroider/webpack 3.2.0
  • @ember/source 5.4.0
  • ember-template-imports 4.0.0

And my Embroider config:

return require('@embroider/compat').compatBuild(app, Webpack, {
    staticAddonTestSupportTrees: true,
    staticAddonTrees: true,
    staticHelpers: true,
    staticModifiers: true,
    staticComponents: true,
    // staticEmberSource: true,
    // splitAtRoutes: ['route.name'], // can also be a RegExp
    packagerOptions: {
      webpackConfig: {
        module: {
          rules: [
            {
              test: /\.css$/i,
              use: [
                {
                  loader: 'postcss-loader',
                  options: {
                    postcssOptions: {
                      config: 'postcss.config.js',
                    },
                  },
                },
              ],
            },
          ],
        },
      },
    },
  });
@pulien
Copy link

pulien commented Mar 19, 2024

I've got the same problem

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

No branches or pull requests

2 participants