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

Creating v2 addon guide #1107

Merged
merged 2 commits into from Feb 4, 2022
Merged

Creating v2 addon guide #1107

merged 2 commits into from Feb 4, 2022

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented Feb 3, 2022

This is the start of a guide on porting addons to v2 format.

["@babel/plugin-proposal-decorators", { "legacy": true }],
"@babel/plugin-proposal-class-properties"
]
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why or why shouldn't we also ship compiled templates?

(for example: https://github.com/NullVoxPopuli/ember-addon-v2-typescript-demo/blob/main/my-addon/babel.config.cjs#L34-L39 )

const { precompile } = require('@glimmer/compiler');

// ...

      resolve('babel-plugin-ember-template-compilation'),
      {
        precompile,
        enableLegacyModules: ['ember-cli-htmlbars'],
      },
    ],

by not compiling away the templates, apps have more work to do, yea?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because the compiled format is deeply tied to the exact ember version that's going to consume it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

gotchya, so this is probably only useful if you can guarantee that addons have the same ember version as apps 🤔

could be tricky

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would be possible to make the wire format (the thing that you'd have if you use babel-plugin-ember-template-compilation) a stable public API, but somebody with knowhow would need to prioritize a little design work.

Copy link
Collaborator

@NullVoxPopuli NullVoxPopuli left a comment

Choose a reason for hiding this comment

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

Nice! this is very detailed!

@ef4 ef4 merged commit 5fd49b5 into main Feb 4, 2022
@ef4 ef4 deleted the v2-addon-guide branch February 4, 2022 00:23
@ef4
Copy link
Contributor Author

ef4 commented Feb 4, 2022

Please try it and give more feedback, but I'm merging so we have a starting point for more PRs.

NullVoxPopuli added a commit to NullVoxPopuli/ember-addon-v2-typescript-demo that referenced this pull request Feb 4, 2022
@angelayanpan
Copy link
Collaborator

angelayanpan commented Feb 7, 2022

| Optimized Embroider Safe | v1 |

in ADDON-AUTHOR-GUIDE.md
is this the same as Embroider Optimized?

@ef4
Copy link
Contributor Author

ef4 commented Feb 7, 2022

Yes, this is the same thing tested by the embroider-safe scenario provide by @embroider/test-setup.

@angelayanpan
Copy link
Collaborator

angelayanpan commented Feb 7, 2022

Once you achieve Optimized Embroider Safe, you should enable the embroider-optimized

Maybe this makes it sound like there is a difference between Optimized Embroider Safe ? and embroider-optimized? I was confused when I read "Optimized Embroider Safe" multiple times before embroider-optimized was mentioned.

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

Successfully merging this pull request may close these issues.

None yet

5 participants