Reputation: 6790
I'm getting an error that looks like it's unable to resolve my import to my other module.
Running rollup -c
I'm getting the following error
(!) Unresolved dependencies
https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency components/main/view (imported by src\index.js)
(!) Missing global variable name
Use output.globals to specify browser global variable names corresponding to external modules C:\Users\n88040\AppData\Roaming\npm\node_modules\rollup\dist\rollup.js (guessing 'View')
src/index.js
import View from 'components/main/view`;
View();
src/components/main/view.js
const View = () => console.log('foo');
export default View;
Upvotes: 5
Views: 2003
Reputation: 44979
See https://rollupjs.org/guide/en#es-module-syntax
You have to import local dependencies with a leading period as otherwise it will be interpreted as an external dependency:
import View from './components/main/view';
Upvotes: 4