diff --git a/src/index.js b/src/index.js index ae60686..f312691 100644 --- a/src/index.js +++ b/src/index.js @@ -28,7 +28,7 @@ export default declare(({ EMIT_DEPRECATED_DEFAULT_PROPS, }) => { const defaultProps = SVG_DEFAULT_PROPS_CODE - ? 'var props = objectAssign({}, SVG_DEFAULT_PROPS_CODE, overrides);' + ? 'var props = objectAssignShim()({}, SVG_DEFAULT_PROPS_CODE, overrides);' : ''; const PROPS_NAME = SVG_DEFAULT_PROPS_CODE ? 'overrides' : 'props'; @@ -164,10 +164,10 @@ export default declare(({ throw new TypeError('the "filename" option is required when transforming code'); } - if (!path.scope.hasBinding('object.assign/implementation')) { + if (!path.scope.hasBinding('object.assign/shim')) { const assignDeclaration = t.importDeclaration([ - t.importDefaultSpecifier(t.identifier('objectAssign')), - ], t.stringLiteral('object.assign/implementation')); + t.importDefaultSpecifier(t.identifier('objectAssignShim')), + ], t.stringLiteral('object.assign/shim')); file.set('ensureObjectAssign', () => { const [newPath] = path.unshiftContainer('body', assignDeclaration); diff --git a/test/sanity.js b/test/sanity.js index 8bac918..50b6cba 100644 --- a/test/sanity.js +++ b/test/sanity.js @@ -19,8 +19,8 @@ function assertMatchImport(name, matchRegex) { const assertReactImport = assertMatchImport('React', () => /import React from ['"]react['"]/g); const assertObjectAssignImport = assertMatchImport( - 'object.assign/implementation', - () => /import objectAssign from ['"]object.assign\/implementation['"]/g, + 'object.assign/shim', + () => /import objectAssignShim from ['"]object.assign\/shim['"]/g, ); function assertDefaultProps(shouldExist, result) {