teleporthq / teleport-code-generators

A collection of code generators for modern JavaScript applications
https://teleporthq.io
MIT License
1k stars 161 forks source link

Building the stencil component with the lerna linked package fails #303

Closed alexnm closed 4 months ago

alexnm commented 5 years ago

It looks like a rollup problem, but I don't have any experience with it so I'll leave an issue for now in case someone wants to grab this.

[ ERROR ]  Rollup: Missing Export: src/components/editor/lazy_jxjixtlsrc9ak1swsggwlw-editor.js:10:9
           'createReactComponentGenerator' is not exported by
           ../teleport-component-generator-react/lib/index.js

      L0:   8: import { h } from '@stencil/core';
      L0:   9: import CodeFlask from 'codeflask';
      L0:  10: import { createReactComponentGenerator } from '@teleporthq/teleport-component-generator-react';
      L0:               ^
      L0:  11: import { createVueComponentGenerator } from '@teleporthq/teleport-component-generator-vue';
      L0:  12: import Prism from 'prismjs';

[42:05.3]  dev server: http://localhost:3333/
[42:05.3]  build failed, watching for changes... in 4.06 s

Currently the teleport-repl-component works with the npm versions 0.7 of the generators. You can reproduce this error by trying to update the package.json to use the latest 0.8.1 and do a yarn inside the root of the monorepo, so lerna will do yarn link for the packages.

JayaKrishnaNamburu commented 5 years ago

May be we should keep an eye on this --> https://github.com/ionic-team/stencil/issues/1491

alexnm commented 5 years ago

it is indeed a problem with symlinks. the module bundler does not work from rollup unless modules are in the current directory node_modules. so if I install version 0.7, all dependencies are brought down into the repl/node_modules and stencil recognizes the commonjs imports and everything. but if dependencies are taken directly as symlinks from the top node_modules rollup doesn't understand commonjs. I believe this could be fixed by including that folder in the rollup-plugin-commonjs inside stencil, but there's no way to configure that :(