grommet / babel-plugin-grommet

Babel plugin to transform member style imports into default imports
Apache License 2.0
4 stars 2 forks source link

Build fails when importing utils from grommet2 #4

Open RyanCCollins opened 6 years ago

RyanCCollins commented 6 years ago

When using babel-plugin-grommet with grommet2, util imports fail the build. You can see the issue below. Ping me for a link to the internal HPE github where I can point you to a commit that shows this.

The line that caused this issue is:

import { deepMerge } from 'grommet2/utils';

The error stack is:

ERROR in ./src/js/utils/theme.js
Module build failed: TypeError: /Users/myMac/Developer/hpe/newstack/ui/src/js/utils/theme.js: Property value expected type of string but got null
    at Object.validate (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-types/lib/definitions/index.js:161:13)
    at validate (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-types/lib/index.js:505:9)
    at Object.builder (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-types/lib/index.js:466:7)
    at ImportDeclaration.memberImports.forEach (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-plugin-grommet/index.js:53:21)
    at Array.forEach (native)
    at PluginPass.ImportDeclaration (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-plugin-grommet/index.js:30:25)
    at newFn (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/visitors.js:276:21)
    at NodePath._call (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/path/context.js:76:18)
    at NodePath.call (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/path/context.js:48:17)
    at NodePath.visit (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/path/context.js:105:12)
    at TraversalContext.visitQueue (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitMultiple (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/context.js:103:17)
    at TraversalContext.visit (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/context.js:190:19)
    at Function.traverse.node (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/index.js:114:17)
    at NodePath.visit (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/path/context.js:115:19)
    at TraversalContext.visitQueue (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/context.js:150:16)
    at TraversalContext.visitSingle (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/context.js:108:19)
    at TraversalContext.visit (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/context.js:192:19)
    at Function.traverse.node (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/index.js:114:17)
    at traverse (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-traverse/lib/index.js:79:12)
    at File.transform (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-core/lib/transformation/file/index.js:548:35)
    at /Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-core/lib/transformation/pipeline.js:50:19
    at File.wrap (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-core/lib/transformation/file/index.js:564:16)
    at Pipeline.transform (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-core/lib/transformation/pipeline.js:47:17)
    at transpile (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-loader/lib/index.js:50:20)
    at Object.module.exports (/Users/myMac/Developer/hpe/newstack/ui/node_modules/babel-loader/lib/index.js:175:20)
 @ ./src/js/components/RoutedSearch.js 44:13-38
 @ ./src/js/components/ListHeader.js
 @ ./src/js/screens/tags/Tags.js
 @ ./src/js/config/routes.js
 @ ./src/js/components/MainRoute.js
 @ ./src/js/components/Main.js
 @ ./src/js/App.js
 @ ./src/js/index.js
error Command failed with exit code 2.
alansouzati commented 6 years ago

interesting I did a commit that was support to fix this.

https://github.com/grommet/babel-plugin-grommet/commit/551dfdd667792feac66d509cb10b3249b0b226cchttps://github.com/grommet/babel-plugin-grommet/commit/551dfdd667792feac66d509cb10b3249b0b226cc

are you on the latest babel plugin?