RollupJS:未解决的内部依赖
RollupJS: Unresolved internal dependency
我收到一个错误,似乎无法解析我对其他模块的导入。
运行 rollup -c
我收到以下错误
(!) 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;
见https://rollupjs.org/guide/en#es-module-syntax
您必须导入带有前导句点的本地依赖项,否则它将被解释为外部依赖项:
import View from './components/main/view';
我收到一个错误,似乎无法解析我对其他模块的导入。
运行 rollup -c
我收到以下错误
(!) 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;
见https://rollupjs.org/guide/en#es-module-syntax
您必须导入带有前导句点的本地依赖项,否则它将被解释为外部依赖项:
import View from './components/main/view';