lab icon indicating copy to clipboard operation
lab copied to clipboard

[Feature request] Import untranspiled components

Open siddharthkp opened this issue 8 years ago • 3 comments

Importing the source file does not work right now, I simple get a syntax error because of import statements and jsx

This also open another feature request which is to resolve component dependencies in the case of composite components. (the import/require statement depicts the relative path)

siddharthkp avatar Nov 28 '17 18:11 siddharthkp

Would you mind clarifying what source file you are importing? Is this a Lab component that's been exported and used in another React app, or is this a component that you're importing into Lab? If it's the latter, Lab should handle ES imports and JSX, so this might be a bug...

jxnblk avatar Dec 17 '17 23:12 jxnblk

The latter, tried to import this component:

import React from 'react'

export default () => <div>hi</div>

Bonus: Would be cool if you can also import tokens from theme. I imagine this will work:

import { colors } from './theme.json'

siddharthkp avatar Dec 17 '17 23:12 siddharthkp

This is definitely a bug, Lab should be able to import that syntax. Is the imported file in the same folder or a subdirectory of where the lab.json file is located? Also if you can include a snippet from the lab.json file where this import is located that could be helpful

jxnblk avatar Dec 20 '17 22:12 jxnblk