Coder Social home page Coder Social logo

Comments (6)

marcofugaro avatar marcofugaro commented on May 20, 2024 2

I also have this warning when using the replace plugin as an output plugin like this

export default {
  input: 'index.js',
  output: {
    dir: 'dist',
    format: 'iife', // amd cjs system esm iife umd
    plugins: [
      replace({'process.env.NODE_ENV': JSON.stringify('production')}),
      terser(),
    ]
  }
}

In my case, I actually need it on the output bundle and it is allowed since #55. So why there is that warning?

from plugins.

lukastaegert avatar lukastaegert commented on May 20, 2024 1

Are you sure you placed the plugins option in the correct place? This error can only occur if it is placed inside the output object. In the documentation you linked, it is placed outside the output object.

from plugins.

shellscape avatar shellscape commented on May 20, 2024 1

@targumon as the issue template mentions, we need a minimal reproduction to triage this. Without that, there's not much we can do.

Issues without minimal reproductions will be closed! Please provide one by:

  1. Using the REPL at https://rollupjs.org/repl/, or
  2. Work to isolate the problem and provide the exact steps in this issue, or
  3. Provide a minimal repository link (Read https://git.io/fNzHA for instructions).
    These may take more time to triage than the other options.

from plugins.

lukastaegert avatar lukastaegert commented on May 20, 2024

Though it might make sense to be able to use this plugin as an output plugin, it is not supported and also would not really make sense as then it would not benefit from tree-shaking.

from plugins.

targumon avatar targumon commented on May 20, 2024

Oh, I feel so stupid. I'm not even sure now where did I copy my bad rollup.config.js from (with plugins inside output instead of adjacent to it).

Thanks and my apologies for the trouble!

from plugins.

targumon avatar targumon commented on May 20, 2024

Found the source of my mistake: before realizing I also need the replace plugin, the first one I used was terser, which is an output plugin... So my initial config had plugins inside output and I naturally thought that that's the place for all plugins.

TL;DR (for whoever gets here from search engines):
There are "regular" plugins and there are output plugins, so your rollup.config.js may contain the plugins option more than once:

export default {
  input: 'index.js',
  output: {
    dir: 'dist',
    format: 'iife', // amd cjs system esm iife umd
    plugins: [
      terser()
    ]
  },
  plugins: [
    replace({'process.env.NODE_ENV': JSON.stringify('production')})
  ]
}

More details here: https://rollupjs.org/guide/en/#using-output-plugins

from plugins.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.