网站搜索
我正在尝试使用 rollup.js 创建两个独立的构建:application.js 和 dependencies.js,分别包含我的应用程序代码和公共库代码(react、react-dom 等)。
文档上说我应该能够简单地使用 externals: ['react', 'react-dom'] 并让它工作——但当我检查生成的 bundle 时,我仍然发现两个库的完整内容都被包含进去了。这里是我的示例 app.config.js
阅读更多 →
在一个 Svelte 组件中,我正在尝试访问我在 rollup 配置文件中设置的对象。我的 rollup.config.js 文件如下所示:
import replace from '@rollup/plugin-replace'; ... export default { ... replace({ foo: JSON.stringify({ bar: 'Hello' }), }), ...在我的 Svelte 组件中,一个简单的 console.log(foo) 可以工作:
阅读更多 →
我一直在制作一个自定义的 Rollup 配置,它可以处理一个 React 项目,并将 js 和 css 内联到 index.html 中。 当我导入一些第三方 React 库(比如 material-ui-color)时,我遇到了 CommonJS 的问题,它提示语法错误。在我尝试安装的库中,“process”这个词最常出现错误。以下是 material-ui-color 问题的日志:
[!] (plugin commonjs) SyntaxError: Unexp 阅读更多 →我正在使用标准的 tsc (v1.8.10) 来编译,并使用 Rollup.js (v0.34.3) 打包一个 Angular 2 应用,但在执行时出现以下错误:
Uncaught TypeError: Class constructor InjectMetadata cannot be invoked without 'new'(…)堆栈跟踪的其余部分似乎通过依赖注入器进行:
decoratorInvocations.map.decoratorInvocation @ app.js:4012 convertTsickleDecoratorIntoMetadata @ app.js:4007 ctorParameters.map @ app.js:3911 parameters @ app.js:3911 parameters @ app.js:4092 _dependenciesFor @ app.js:4531 resolveReflective 阅读更多 →
我正在构建这个项目 angular2-google-maps-test,并且我想包含并扩展这个 JS 库 js-marker-clusterer
似乎并没有被写成一个 模块。
function MarkerClusterer(map, opt_markers, opt_options) { // MarkerClusterer implements google.m 阅读更多 →正如标题所说,目前我没有任何代码示例,为什么将 Rollup、Vue、Typescript 和 vue-property-decorator 结合起来是如此不可能?每当我尝试时,它都想将 vue-property-decorator 添加为外部依赖。任何可行解决方案的链接都将不胜感激。
阅读更多 →我正在尝试使用typescript和rollup创建一个组件库。
我有一个组件,Canary。
function Canary() { ... } export default React.memo(Canary)注意 Canary 是如何被一个高阶组件 (React.memo) 包裹的。
我有另一个组件,SomeComponent
function SomeComponent() { ... } export default SomeComponent如果我只用导出的 SomeComponent 来构建我的库,
export { def 阅读更多 →我有一个 .d.ts 文件,并在 .ts 文件中 import 该 exports,当我使用 tsc 编译 .ts 文件时,它成功生成了 js 文件。
但是当我使用 rollup(插件包括 rollup-plugin-typescript2、rollup-plugin-node-resolve 和 rollup-plugin-commonjs)时,它报告无法解析该导入。
有人能告诉我为什么吗?
阅读更多 →我尝试构建一个 react-native/-web 库,以在两个项目之间共享组件,但当在组件中使用这些 react-native 组件时,rollup 无法识别它们,并返回以下错误:
(!) Unused external imports View,Text,TouchableOpacity,ActivityIndicator,TextInput,Picker,FlatList,StatusBar imported from external module 'react-native' but never used default imported from external module 'react-native-easy-content-loader' but never used Svg,G,Path,default,Polygon,Polyline,Rect,Circle,Defs,Mask,Use imported from external module 'react-native-svg' but never used TextInpu 阅读更多 →在我的源代码中,这个导入路径是正确的:
<img src={"../../../../assets/logo.svg"} />但相对路径在打包过程中会发生变化。我如何才能让代码在打包后继续工作?
我认为如果我的项目是纯 JS,我可以使用 @rollup/plugin-image。但我还没有让它在我的 TypeScript 项目中工作。
当我尝试按照文档中的描述使用它时,我在项目中收到以下错误:
Cannot find module '../../../../assets/logo.svg' or its corresponding type declarations.阅读了关于这个话题的其他几个帖子后,我尝试通过在我的项目中添加一个 types.d.ts 文件来解决这个问题:
declare module "*.s 阅读更多 →