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

optional ES-module compatibility setting #1548

Merged
merged 1 commit into from
Jul 19, 2023
Merged

optional ES-module compatibility setting #1548

merged 1 commit into from
Jul 19, 2023

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented Jul 18, 2023

This introduces a new option that opts-in to stricter behavior when we're trying to help v1 addons access legacy AMD modules. Previously, we always depended on looseness in webpack that allows us to mix CJS (which could fully-match the runtime egacy AMD behaviors) and ES modules. We would emit a CJS shim for each unknown module that would locate the module in the AMD loadeder at runtime.

With this new setting amdCompatibility: { es }, no automatic shims get emitted for missing modules. Instead you must manually list specific shims that you need (because the ES modules shims need their exports known statically in advance).

This setting is only recommended when also setting staticEmberSource: true, because otherwise ember itself needs a whole lof shimming.

In addition, this PR includes some defensive improvements to our rollup and babel plugins so that they filter query params off of filenames. This makes them more robust in build systems like vite that like to tack cache-busting query params onto everything.

This introduces a new option that opts-in to stricter behavior when we're trying to help v1 addons access legacy AMD modules. Previously, we always depended on looseness in webpack that allows us to mix CJS (which could fully-match the runtime egacy AMD behaviors) and ES modules. We would emit a CJS shim for each unknown module that would locate the module in the AMD loadeder at runtime.

With this new setting `amdCompatibility: { es }`, no automatic shims get emitted for missing modules. Instead you must manually list specific shims that you need (because the ES modules shims need their exports known statically in advance).

This setting is only recommended when also setting `staticEmberSource: true`, because otherwise ember itself needs a whole lof shimming.

In addition, this PR includes some defensive improvements to our rollup and babel plugins so that they filter query params off of filenames. This makes them more robust in build systems like vite that like to tack cache-busting query params onto everything.
@ef4 ef4 added the enhancement New feature or request label Jul 18, 2023
@ef4 ef4 merged commit 0e00f2b into main Jul 19, 2023
196 checks passed
@ef4 ef4 deleted the es-externals branch July 19, 2023 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant