Questions tagged [rollupjs]

Rollup.js is a next-generation JavaScript Transpiler and module bundler

rollup.js is a module bundler, similar to browserify, but targeting code written as ES2015 modules.

Rollup takes advantage of the fact that ES2015 import and export declarations are statically analyzable and only bundles the functions / values that are actually referenced.

1172 questions
21
votes
3 answers

rollup.JS and "'this' keyword is equivalent to 'undefined'

I'm trying to bundle Angular2 modules using Rollup.js. this is my rollup.config.vendor.js file: import typescript from 'rollup-plugin-typescript2'; import resolve from 'rollup-plugin-node-resolve'; import commonjs from…
Idov
  • 5,006
  • 17
  • 69
  • 106
19
votes
1 answer

WARNING: No name was provided for external module 'X' in output.globals – guessing 'X'

WARNING: No name was provided for external module 'moment' in output.globals – guessing 'momentImported' WARNING: No name was provided for external module 'odata-parser' in output.globals – guessing 'parser' I receive this message when I try to…
ROMAN
  • 1,476
  • 2
  • 11
  • 24
19
votes
3 answers

Does rollup bundle node_modules into bundle.js?

I am testdriving rollupjs to package a node app into a bundle.js and am confused. Does rollup support bundling a full node app (including node_modules), or just the js files that are part of your project? I have a standard node project (1…
18
votes
4 answers

Error Could not resolve entry module React + Rollup

I need to build shareable React component which could be used across apps. For this, I was/am following the below article https://dev.to/alexeagleson/how-to-create-and-publish-a-react-component-library My Configuration looks exactly the same…
Kgn-web
  • 7,047
  • 24
  • 95
  • 161
17
votes
2 answers

Is singleton guaranteed to be preserved during webpack or rollup module bundling process?

Understanding the fact that singleton creates a shared global state, there will be situations where I might want singleton such as redux store/state object. If I am using ES modules, I can use the simple code as follows to create singleton: // a.js…
Harshal Patil
  • 17,838
  • 14
  • 60
  • 126
16
votes
3 answers

How do I export Typescript interfaces from a node module?

Figured it out! Initially, I was trying to import my module like this: const qml = require('quill-marking-logic') const { checkSentenceCombining, checkSentenceFragment, checkDiagnosticQuestion, checkFillInTheBlankQuestion, ConceptResult } =…
E. Friedberg
  • 161
  • 1
  • 1
  • 5
16
votes
3 answers

Proper way to chain PostCSS and SASS in rollup

I'm trying to set up rollup to use both SCSS stylesheets and the Lost grid system, which needs to be parsed through PostCSS. I've verified that the SCSS is being parsed correctly, but the PostCSS processor doesn't seem to have any effect. According…
bright-star
  • 6,016
  • 6
  • 42
  • 81
15
votes
4 answers

Polyfill node os module with vite/rollup.js

I'm working on a Vite project which uses the opensea-js package. This package depends on xhr2-cookies. which imports os, http, https and some other internal node modules. I'm getting this error when trying to call any of the opensea…
Benedict Lewis
  • 2,733
  • 7
  • 37
  • 78
15
votes
2 answers

Absolute imports with rollup

I'm trying to get imports like import { startup } from "applicationRoot/renderUI"; to work, from anywhere in my application. I thought the rollup-plugin-alias would be a good fit for this. I tried configuring alias({ applicationRoot:…
Adam Rackis
  • 82,527
  • 56
  • 270
  • 393
14
votes
1 answer

Vite - How do I use a wildcard in Rollupjs build.rollupOptions.external?

I'm using Vite to build a library and I get the following error when building the library: Rollup failed to resolve import "node:path" By adding the failed import to the Rollup options I'm able to fix the error but the build continues to complain…
Carlton
  • 531
  • 1
  • 5
  • 19
14
votes
1 answer

Library mode in vitejs: How should I manage external dependencies?

Let's say I'm building a library with a few dependencies: react, moment, lodash, and uuid, and I want to distribute this in both ES and UMD format. I'm also wary of the final bundle size of the user's application. React should go into…
Jimmy C
  • 9,270
  • 11
  • 44
  • 64
14
votes
0 answers

Can I generate component level css files using RollupJs for my component library?

I'm running into some issues when trying to create a component library with RollupJS. I'm building a react component library to be used inside other projects. The library uses css-modules for the styling of the components. I currently have a basic…
WD86
  • 151
  • 4
14
votes
1 answer

Rollup with gulp and typescript outputs Cannot find module 'tslib/tslib.es6.js'

I followed the typescript gulp in the doc :https://rollupjs.org/guide/en#gulp here is my gulp file : const gulp = require("gulp"); const rollup = require("rollup"); const rollupTypescript = require("rollup-plugin-typescript"); gulp.task("build", ()…
Steven
  • 817
  • 1
  • 8
  • 25
14
votes
2 answers

How to deal with side effects in tree shaking code?

I've been trying to learn how to write code that is tree shaking friendly, but have run into a problem with unavoidable side effects that I'm not sure how to deal with. In one of my modules, I access the global Audio constructor and use it to…
Steven Lambert
  • 5,571
  • 2
  • 29
  • 46
14
votes
1 answer

Rollup: globals & external

I'm trying to rollup my completely es6 module repo which has both local imports/export for the projects, and imports to dependencies that are also either scripts or modules. I'm also trying to have a dual build which creates legacy iife modules via…
backspaces
  • 3,802
  • 6
  • 34
  • 58
1
2
3
78 79