-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Labels
Description
Environment
- @blueprintjs/core 3.12.0
- Windows 10 / Chrome 71
Steps to reproduce
- Do the following import:
import { Position, Toaster, Intent } from "@blueprintjs/core";
- Make a production build using webpack 4
- Load and execute the page on IE11
Actual behavior
IE11 console errors: Object doesn't support property or method 'remove'
Expected behavior
No error should appear
Possible solution
It appears that the dom4 polyfill that includes the .remove() functionality is not included during the production build. This is because @blueprintjs/core is marked as sideEffect: false in package.json. Which means that webpack will cut away any unused imports/exports. Including the following lines which are responsible for loading in dom4:
blueprint/packages/core/src/components/index.ts
Lines 8 to 13 in b40b5a1
if (typeof window !== "undefined" && typeof document !== "undefined") { | |
// we're in browser | |
// tslint:disable-next-line:no-var-requires | |
require("dom4"); // only import actual dom4 if we're in the browser (not server-compatible) | |
// we'll still need dom4 types for the TypeScript to compile, these are included in package.json | |
} |
Solution is to mark this file as a sideEffect, see https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free