Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration option is out of date in "Rollup.js Tutorial, Part 1: How to Set Up Smaller, More Efficient JavaScript Bundling Using Rollup" #48

Open
dance2die opened this issue Apr 11, 2018 · 1 comment

Comments

@dance2die
Copy link

What's wrong?

The rollup.config.js in the tutorial is out of date.

Error Steps

The tutorial, Rollup.js Tutorial, Part 1: How to Set Up Smaller, More Efficient JavaScript Bundling Using Rollup using the following configuration option fails

export default {
  entry: "src/scripts/main.js",
  dest: "build/js/main.min.js",
  format: "iife",
  sourceMap: "inline"
};

with following messages.

dance2die@CC c:\misc\sources\throwaway\rollupdemo\learn-rollup
> .\node_modules\.bin\rollup -c
(!) Some options have been renamed
https://gist.github.com/Rich-Harris/d472c50732dab03efeb37472b08a3f32
entry is now input
sourceMap is now output.sourcemap
format is now output.format
dest is now output.file

src/scripts/main.js → build/js/main.min.js...
[!] Error: You must specify options.format, which can be one of 'amd', 'cjs', 'system', 'es', 'iife' or 'umd'
https://rollupjs.org/#format-f-output-format-
Error: You must specify options.format, which can be one of 'amd', 'cjs', 'system', 'es', 'iife' or 'umd'
    at error (c:\misc\sources\throwaway\rollupdemo\learn-rollup\node_modules\rollup\dist\rollup.js:224:15)
    at checkOutputOptions (c:\misc\sources\throwaway\rollupdemo\learn-rollup\node_modules\rollup\dist\rollup.js:19531:9)
    at normalizeOptions (c:\misc\sources\throwaway\rollupdemo\learn-rollup\node_modules\rollup\dist\rollup.js:19603:21)
    at generate (c:\misc\sources\throwaway\rollupdemo\learn-rollup\node_modules\rollup\dist\rollup.js:19607:41)
    at Object.write (c:\misc\sources\throwaway\rollupdemo\learn-rollup\node_modules\rollup\dist\rollup.js:19638:32)
    at c:\misc\sources\throwaway\rollupdemo\learn-rollup\node_modules\rollup\bin\rollup:3430:77
    at next (c:\misc\sources\throwaway\rollupdemo\learn-rollup\node_modules\rollup\bin\rollup:3371:32)
    at c:\misc\sources\throwaway\rollupdemo\learn-rollup\node_modules\rollup\bin\rollup:3374:53
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:182:7)

How to fix it

Rollup.JS documentation has a different format for the rollup.config.js and the following works for the tutorial

export default {
  input: "src/scripts/main.js",
  output: {
    file: "build/js/main.min.js",
    format: "iife",
    sourceMap: "inline"
  }
};

With the new configuration above,

Rollup Version

"rollup": "^0.57.1"

@jlengstorf
Copy link
Owner

@dance2die This tutorial is about an older version of Rollup, unfortunately. However, I'd really appreciate a PR on the article to update that config! https://github.com/jlengstorf/code.lengstorf.com/blob/master/content/blog/learn-rollup-js.md

Thanks for reading and sending in feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants