gpt4 book ai didi

node.js - 汇总 : Unresolved Dependencies

转载 作者:搜寻专家 更新时间:2023-10-31 23:40:22 28 4
gpt4 key购买 nike

我在使用带汇总的 npm 包(特别是 lodash)时遇到问题。

我收到 Unresolved 依赖项错误。我已经安装了 rollup-plugin-node-resolverollup-plugin-commonjs 并根据文档进行了配置。我可能错过了一些明显的东西。

错误

[~/Projects/rollup] yarn run build
yarn run v1.2.1
$ rollup -c

src/main.js → ./build/app.js...
(!) Unresolved dependencies
https://github.com/rollup/rollup/wiki/Troubleshooting#treating-module-as-external-dependency
loadash (imported by src/main.js)
(!) Missing global variable name
Use options.globals to specify browser global variable names corresponding to external modules
loadash (guessing 'loadash')
created ./build/app.js in 47ms
✨ Done in 0.93s.

src/main.js

import { map } from 'loadash';
console.log('Test');

rollup.config.js

import commonjs from 'rollup-plugin-commonjs';
import resolve from 'rollup-plugin-node-resolve';

export default {
input: 'src/main.js',
output: {
file: './build/app.js',
format: 'iife'
},
plugins: [
resolve({
jsnext: true,
main: true,
browser: true,
}),
commonjs()
]
};

我做错了什么?

最佳答案

它叫lodash,不是loadash!

关于node.js - 汇总 : Unresolved Dependencies,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46965859/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com