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

Setting broserslist to "ie 9" lacks "MutationObserver" object #9842

Open
SetTrend opened this Issue Apr 9, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@SetTrend
Copy link

commented Apr 9, 2019

Bug Report

MutationObserver undefined

Current Behavior
When polyfilling down to IE9, @Babel/polyfill seems to lack an implementation for the MutationObserver object (see screenshot).

Input Code
– private, proprietary –

Expected behavior/code
MutationObserver should be polyfilled.

Babel Configuration (.babelrc, package.json, cli command)

webpack.config.js

{
  test: /\.js$/i,
  include: [
    /[/\\]node_modules[/\\]lit-html[/\\]/i,
    /[/\\]node_modules[/\\]@babel[/\\]/i,
    /[/\\]node_modules[/\\]@webcomponents[/\\]/i
  ],
  use: {
    loader: 'babel-loader',
    options: {
      presets: ['@babel/preset-env']
    }
  }
}

.babelrc

{
	useBuiltIns: false
}

browserslist

ie 9

main.ts

import "@babel/polyfill"

import "@webcomponents/webcomponentsjs/webcomponents-bundle";
import '@webcomponents/webcomponentsjs/custom-elements-es5-adapter.js';

Environment

  • Babel version(s):
    "@babel/core": "^7.4.3"
    "@babel/polyfill": "^7.4.3"
    "@babel/preset-env": "^7.4.3"
  • Node/npm version: v10.15.3/6.4.1
  • OS: Windows 10x64
  • How you are using Babel: webpack
@babel-bot

This comment has been minimized.

Copy link
Collaborator

commented Apr 9, 2019

Hey @SetTrend! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community
that typically always has someone willing to help. You can sign-up here
for an invite.

@SetTrend

This comment has been minimized.

Copy link
Author

commented Apr 9, 2019

As a workaround, I installed mutationobserver-shim. Now I can see that the following Object/Event properties are not available, too:

Object.setPrototypeOf

Object.setPrototypeOf

Event.composedPath

Event.composedPath

@nicolo-ribaudo

This comment has been minimized.

Copy link
Member

commented Apr 9, 2019

Babel only polyfills ECMAScript methods (i.e. things available in every JS engine, not just in browsers).

MutationObserver and Event.composedPath are Web API, so you need to manually load polyfills for them.

Object.setPrototypeOf should be polyfilled 🤔

@SetTrend

This comment has been minimized.

Copy link
Author

commented Apr 9, 2019

Thanks for clarifying, @nicolo-ribaudo!

I'm not sure if this distinction comes clear from the readme.

For now, I've been using: https://gist.github.com/edoardocavazza/47246856759f2273e48b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.