Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Joe Pea

    Hey you all, I'm not seeing source maps. I'm trying

            // ...
            sourcemap: true,

    Is that where I put the option?

    Michael Bøcker-Larsen

    I just moved to rollup for this plugin I wrote mblarsen/browser-acl I have the following keys in my package json: browser (umd), main (cjs), and module (esm) -- so far all is good and published to npm.

    But now when I use the lib in my client code in a webpack based project, e.g.

    import Acl, {GlobalRule} from 'browser-acl'

    The import is no longer working. Name issues or undefined issues.

    Only if I explicitly import the esm version it works, like so:

    import Acl, {GlobalRule} from 'browser-acl/dist/browser-acl.esm.js'

    Any idea what the issue and a workaround is?

    Michael Bøcker-Larsen
    Basically my problem is the reverse of this webpack/webpack#5756
    Michael Bøcker-Larsen
    Is there no way to support the browser, module, and main fields and not having to force the user to either explicitly import the esm version or create an alias for it in the webpack config? (which is explicit by a diffrent name)
    Joe Pea
    seems like a webpack problem. Rollup only bundles the code. How it is imported by a consumer is another issue (Webpack?)
    Peter Mikitsh

    Hi All, hoping to get some help here:

    My issue: Buffer is being polyfilled, however, my code still references the Buffer global. When running in the browser, I get a Buffer is not defined error.


    Screenshot of config / bundle: https://drive.google.com/file/d/1-RGc4Iwzn_1EsXQm-UFVZ1wwQWo_0zeL/view?usp=sharing

    Augustin C.

    Hi everyone,

    I'm using rollup to build components packages in a lerna powered repo.
    I'm uncertain of the strategy :

    • have rollup as a root dependency of the repo and manage programmaticaly the rollup config to build each component
    • have rollup as a dependency of each component + one rollup config per component

    Any idea ?

    Kevin Connors
    Anyone know of resources for webpack? I want to use it for async/await and rollup is just not working
    Victoria French
    hey all. Do you know what changed in .4 from .3 that would cause rollup to freeze on ubuntu? We have a massive project and haven't had any issues for years, yesterday I updated to .4 and everything looked fine on macos. But the ubuntu build server freezes (waited 24 the first time, every build after still freezes). Downgrade to .3 and it's fine. I looked at the diff in github between the two and don't really see anything
    oh an no error messages... just simply freezes
    Kelly Thomas Kline
    If my goal is to generate a single amalgamated JS file that can simply be linked in from an HTML file, which target from https://rustwasm.github.io/wasm-pack/book/commands/build.html#target is preferrable as a source for rollup to use?
    Chris Drackett
    I'm getting a less than helpful error and curious if anyone can point me in the right direction:
    (!) Error when using sourcemap for reporting an error: Can't resolve original location of error.
    node_modules/react/index.js: (23:29)
    [!] Error: Unexpected token
    node_modules/react/index.js (23:29)
    Kelly Thomas Kline
    Can options be passed to rollup ./main.js --format iife --file ./pkg/bundle.js that cause bundle.js to have {credentials: "include", mode: "cors"} added to the fetch it contains?
    Edward Hong
    @kevinforrestconnors Have you looked at Survive.js? It's a free book on webpack that's quite well done. Don't you need Babel for async/await syntax? I'm not sure how it's a bundler issue
    Curtis Maloney
    You'd only need babel, surely, if your target doesn't support the syntax?
    Curtis Maloney
    does anyone else find that when trying to bundle a react app they have to construct an enormous list of namedExports for commonjs plugin?
    or am I just doing it wrong?
    Austin Ziegler
    I’m using rollup.js with Vue.js and I’ve got some bundled (npm) Vue components that are trying to inject <style> tags at runtime because they have bundled CSS. Is there any way that I can cause bundled CSS to be hoisted into my application’s CSS? The problem with the injection of the <style> tags is that I am trying to build a strict Content-Security-Policy that does not include any unsafe-inline specifications.
    i tried import goog from 'google-closure-library' but it not works
    Christopher Pietrzykowski
    @kapilpipaliya I think, haven't used it, you can use it as import 'google-closure-library -- it appears that goog is added a global.
    re: rollup/rollup#1962, but with typescript and proper js linting! importing fake modules isn't really nice, they occlude existing library defs. So, can this issue be reopened?
    no need, i will not use this library
    Bodo Graumann
    Hi there
    trying to build typescript lib and transpile one dependency into esmodule
    using the node-resolve, typescript, commonjs and babel plugins
    how can I make rollup keep the polyfills as includes instead of directly including their code?
    I tried resolve({ only: ["p-event"] }), but that doesnt work :-(
    Jacob Raihle
    Hi! I am trying to use rollup in a rush mono-repo. Rollup outputs a list of all built files to STDERR, which causes rush to emit a non-zero exit code, making my build server mark it as a failure.
    I have tried using the --silent flag, but this suppresses too much, and it seems I do not even get any calls to my onwarn handler. Is there any way I can configure rollup to get rid of this confounding output?
    Bodo Graumann
    I just put core-js into peerDependencies
    also .babelrc local vs. babel.config.js global WTF???
    Jacob Raihle
    Nevermind, this seems to have been fixed already in 1.16.5, I just could not find any reference to it 🤦
    Walle Cyril
    I would recommend against using peerDependencies
    Hi I wanted to adjust the rollup config so that instead of <link rel='stylesheet' href='/bundle.css'>
    <link rel='stylesheet' href='bundle.css'>
    any ideas ?
    Walle Cyril
    what plugin are you using for that ? Best is to open an issue in that dedicated plugin git
    Curtis Maloney
    @halostatue when I last did a project using rollup and Vue, I passed "css: false" to the vue() plugin, which [iirc] made it emit the CSS as separate chunks, which were then collected by the scss plugin [or postcss if you prefer]
    @weepy my rollup-plugin-index will do that [but only if you're OK with all your <script> tags being type="module" ]
    Ben Tilford
    Is there a hook to grab the file [hash] so html references can be updated? Also why do both js and css have the same hash? I thought it was based on file contents?
    how to integrate sass in my rollup config?
    Curtis Maloney
    @kapilpipaliya there's a few options
    I find rollup-plugin-postcss is the easiest
    Ádám Lippai
    What's the preferred style using rollup? https://material-ui.com/guides/minimizing-bundle-size/
    Named imports or top level imports? (Assuming @material-ui/core/* can be large)
    Does rollup traverse every import or just the imports used?
    Taylor Hunt
    Is there a similar convention in Rollup plugins to annotate modules, like Webpack’s querystrings?
    Taylor Hunt
    I'm trying to write a Rollup plugin for Marko, to improve on their current Webpack plugin
    Ryan Murphy
    Hello! I had a Q about whether it's an anti-pattern for a plugin to use the generateBundle hook to alter file names — the reason I'm in this space is that I'm using a virtual entrypoint (AKA it starts with \0), but that leads to the final filename given to the entrypoint to have a leading underscore (and any extra text I may have added to the name). So what I'm currently doing is reaching into the bundle and re-writing the filename (and SourceMap filename) to remove any of the text (currently doing a chunk.fileName.replace('<my extra text>', '')) that traveled with the filename. Is this a potentially dangerous move?
    not exactly doing what rollup-plugin-multi-entry does, but it's similar enough — basically trying to not have that long placeholder that's considered the entrypoint's filename get output https://github.com/rollup/rollup-plugin-multi-entry/blob/master/src/index.js#L40