Skip to content

Disable Ember modules polyfill on 3.27+#337

Merged
RobbieTheWagner merged 1 commit intohtml-next:ember-3.16from
chancancode:disable-polyfills
Oct 6, 2021
Merged

Disable Ember modules polyfill on 3.27+#337
RobbieTheWagner merged 1 commit intohtml-next:ember-3.16from
chancancode:disable-polyfills

Conversation

@chancancode
Copy link
Copy Markdown
Contributor

When compiling with compileModules: false, ember-cli-babel defaults to using the modules polyfill, since it assumes we are concatenating the output script using app.import without an AMD wrapper.

This does not apply to us, since we are compiling the -private modules into a single AMD module (via rollup below), which can in fact have external dependencies.

We can opt-out of this with disableEmberModulesAPIPolyfill: true. In Ember versions with "real modules", that is what we want in order to avoid the Ember global deprecation (or just completely not working in 4.0+).

It seems like the intent may have been that we should be able to set this to true unconditionally, and ember-cli-babel will ignore this setting if the Ember verion requires the modules API polyfill. However, presumably due to a bug, ember-cli-babel actually checks for this value first and return out of the function early if its value is truthy. This means that if we set this to true unconditionally, then we would have disabled the modules polyfill for Ember versions that needs it, which would be incorrect. Therefore, we have to duplicate the detection logic here in order to set this value appropriately.

https://github.com/babel/ember-cli-babel/blob/4c3b9091d7c711ecb804a52226409b409a702d82/lib/babel-options-util.js#L159-L172

Ideally, we should just stop trying to rollup the -private modules and let the modern build pipeline optimizes things for us, then none of this would have been necessary.

When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
@chancancode
Copy link
Copy Markdown
Contributor Author

cc @rwjblue @ef4

@RobbieTheWagner RobbieTheWagner merged commit eddc9e3 into html-next:ember-3.16 Oct 6, 2021
@ef4
Copy link
Copy Markdown

ef4 commented Oct 6, 2021

Yes, this rollup usage is fragile and of dubious value. Even if it's beneficial, it should run at a prepublish and not within every app's build.

@chancancode chancancode deleted the disable-polyfills branch October 6, 2021 04:41
@RobbieTheWagner
Copy link
Copy Markdown
Member

I would be okay with removing the custom private rollup stuff if @runspired is. Thoughts @runspired?

mixonic pushed a commit that referenced this pull request Dec 8, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
mixonic pushed a commit that referenced this pull request Dec 8, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
mixonic pushed a commit that referenced this pull request Dec 9, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
mixonic pushed a commit that referenced this pull request Dec 9, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
@mixonic mixonic mentioned this pull request Dec 9, 2021
mixonic pushed a commit that referenced this pull request Dec 9, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
mixonic pushed a commit that referenced this pull request Dec 9, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
mixonic pushed a commit that referenced this pull request Dec 9, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
mixonic pushed a commit that referenced this pull request Dec 9, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
mixonic pushed a commit that referenced this pull request Dec 9, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
mixonic pushed a commit that referenced this pull request Dec 9, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
mixonic pushed a commit that referenced this pull request Dec 9, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
mixonic pushed a commit that referenced this pull request Dec 9, 2021
When compiling with `compileModules: false`, ember-cli-babel defaults to
using the modules polyfill, since it assumes we are concatenating the
output script using `app.import` without an AMD wrapper.

This does not apply to us, since we are compiling the `-private` modules
into a single AMD module (via rollup below), which can in fact have
external dependencies.

We can opt-out of this with `disableEmberModulesAPIPolyfill: true`. In
Ember versions with "real modules", that is what we want in order to
avoid the Ember global deprecation (or just completely not working in
4.0+).

It seems like the intent may have been that we should be able to set
this to `true` unconditionally, and `ember-cli-babel` will ignore this
setting if the Ember verion requires the modules API polyfill. However,
presumably due to a bug, ember-cli-babel actually checks for this value
first and return out of the function early if its value is truthy. This
means that if we set this to true unconditionally, then we would have
disabled the modules polyfill for Ember versions that needs it, which
would be incorrect. Therefore, we have to duplicate the detection logic
here in order to set this value appropriately.

Ideally, we should just stop trying to rollup the -private modules and
let the modern build pipeline optimizes things for us, then none of this
would have been necessary.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants