diff --git a/.babelrc b/.babelrc index 1a12c35ef..36dd965cd 100644 --- a/.babelrc +++ b/.babelrc @@ -2,6 +2,8 @@ "presets": ["airbnb"], "plugins": [ ["transform-replace-object-assign", { "moduleSpecifier": "object.assign" }], + "syntax-dynamic-import", + "dynamic-import-node" ], ignore: [ "packages/enzyme-test-suite/test/_helpers/untranspiled*", diff --git a/package.json b/package.json index 01c8446d4..874cf439c 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,8 @@ "babel-core": "^6.26.3", "babel-eslint": "^7.2.3", "babel-loader": "^6.4.1", + "babel-plugin-dynamic-import-node": "^2.2.0", + "babel-plugin-syntax-dynamic-import": "^6.18.0", "babel-plugin-transform-replace-object-assign": "^1.0.0", "babel-preset-airbnb": "^2.6.0", "babel-register": "^6.26.0", diff --git a/packages/enzyme-test-suite/test/Adapter-spec.jsx b/packages/enzyme-test-suite/test/Adapter-spec.jsx index f5cd61975..3ab12ee2b 100644 --- a/packages/enzyme-test-suite/test/Adapter-spec.jsx +++ b/packages/enzyme-test-suite/test/Adapter-spec.jsx @@ -15,6 +15,7 @@ import { createContext, createPortal, forwardRef, + lazy, Fragment, StrictMode, AsyncMode, diff --git a/packages/enzyme-test-suite/test/_helpers/dynamicImportedComponent.jsx b/packages/enzyme-test-suite/test/_helpers/dynamicImportedComponent.jsx new file mode 100644 index 000000000..3afa41bb0 --- /dev/null +++ b/packages/enzyme-test-suite/test/_helpers/dynamicImportedComponent.jsx @@ -0,0 +1,11 @@ +import React from 'react' + +class DynamicComponent extends React.Component { + render() { + return ( +