rollup / rollup-starter-lib

Bare-bones example of how to create a library using Rollup
MIT License
966 stars 229 forks source link

Am I using `external` incorrectly? #14

Closed davestewart closed 5 years ago

davestewart commented 6 years ago

Hello :)

TLDR; I've used this project to bundle my plugin, but I can't seem to reference it in a demo project

I'm upgrading a project of mine, a Vue JS plugin called VueSource to use Rollup as the bundler.

I'm using this project as the starting point, as it seems the most likely candidate I've found to successfully create a module I can use in other projects, and publish to NPM.

The current branch for this upgrade is:

To make sure the plugin is robust before publishing, I generally host a demo project side-by-side with the plugin, using Vue CLI to compile the web app and NPM Link to see changes live as I update the plugin:

+- VueSource
    +- vue-source
    +- vue-source-demo

The current branch for this demo project is:

This setup has worked very successfully in other projects using Webpack.

However, although I've got the bundling, linking and compiling working, when the browser loads the demo webapp, the plugin is undefined:

image

In the image above the ../vue-source link seems curious to me, as I would have expected to have seen it in node_modules - where it actually is.

At first I thought this might be an NPM link problem, but now I am thinking this has more to do with Rollup's external option.

I confirmed this by adding a breakpoint to both files, and it seems that both actually load so I'm suspecting that the reason that the module is undefined has something to do with this, though I'm not sure.

Can anyone shed any light?

Thanks.

eventualbuddha commented 5 years ago

Closing as stale. This isn't really the best place to ask this sort of question, though I appreciate how thorough you were in detailing it. I hope you got it sorted out!