GithubHelp home page GithubHelp logo

jlengstorf / learn-rollup Goto Github PK

View Code? Open in Web Editor NEW
190.0 5.0 61.0 27 KB

This is an example project to accompany a tutorial on using Rollup.

Home Page: https://code.lengstorf.com/learn-rollup-js/

License: ISC License

JavaScript 57.29% CSS 27.19% HTML 15.52%
rollup tutorial video bundle javascript es2015-modules tree-shaking

learn-rollup's Introduction

Learn Rollup.js

This is an example project to accompany a tutorial on using Rollup.

See the video of how this was made at https://code.lengstorf.com/learn-rollup-js/

Quickstart

# Clone the repo
git clone [email protected]:jlengstorf/learn-rollup.git

# Move into the repo
cd learn-rollup/

# Install dependencies
npm install

# Start the watcher
npm run watch

Alternative Configurations

learn-rollup's People

Contributors

flaviomicheletti avatar jlengstorf avatar lguzzon avatar ypid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

learn-rollup's Issues

Error: 'LinearProgress' is not exported by node_modules/material-ui/Progress/index.js

// Rollup plugins
import babel from 'rollup-plugin-babel';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
import uglify from 'rollup-plugin-uglify';
import postcss from 'rollup-plugin-postcss';

// PostCSS plugins
import simplevars from 'postcss-simple-vars';
import nested from 'postcss-nested';
import cssnext from 'postcss-cssnext';
import cssnano from 'cssnano';

export default {
  entry: 'src/containers/ReactCdPlayer.js',
  dest: 'lib/js/main.min.js',
  format: 'iife',
  sourceMap: 'inline',
  plugins: [
    postcss({
      plugins: [
        simplevars(),
        nested(),
        cssnext({ warnForDuplicates: false, }),
        cssnano(),
      ],
      extensions: [ '.css' ],
    }),
    resolve({
      jsnext: true,
      main: true,
      browser: true,
    }),
    commonjs(),
    babel({
      exclude: 'node_modules/**',
    }),
    replace({
      exclude: 'node_modules/**',
      ENV: JSON.stringify(process.env.NODE_ENV || 'development'),
    }),
    (process.env.NODE_ENV === 'production' && uglify()),
  ],
};
☁  react-cd-player [master] ⚡ yarn rollup-build
yarn rollup-build v0.24.5
$ rollup -c
🚨   Error: 'LinearProgress' is not exported by node_modules/material-ui/Progress/index.js
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
src/containers/ReactCdPlayer.js (7:9)
5: import FastForward from 'material-ui-icons/FastForward';
6: import FastRewind from 'material-ui-icons/FastRewind';
7: import { LinearProgress } from 'material-ui/Progress';
            ^
8:
9: import Cd from '../components/Cd';

error Command failed with exit code 1.

Use & instead of npm-run-all

There's no need to install package npm-run-all when all it does is run 2 scripts in parallel. Simply write in package.json:

"watch": "npm run reload & npm run dev"

hi! thanks alot for the great tutorial! i am using livereload and it works, opening the index html directly in chrome. But when loading a local csv (d3.csv) i get cross origin problems. Is there a way to fix this? best malte

Please note that this is not a support forum for Rollup. If your issue is not directly related to the tutorial code, this is NOT the right place to open an issue.

If you are getting Rollup errors with a particular module, try opening an issue on that module's repo first.

If you are getting Rollup errors with multiple modules, open an issue on the Rollup repo: https://github.com/rollup/rollup

Thanks!

Your method of importing debug results in an error

When I try to import and use debug the way you are:

import debug from 'debug';
const log = debug('app:log');

It results in the error Module "..../debug/index" has no default export.. I have to import it like this:

import * as debug from 'debug';

which then results in a rollup error:

Cannot call a namespace ('debug')

Any idea what the difference might be?

rollup how to package multi-page application?

hi,I would like to ask a question, rollup how to package multi-page application, it seems to be only a single entry (a string), unlike the webpack entry can be an array or object. My current solution is to traverse the rollup configuration file to generate multiple bundles, but can not generate a common bundle like webpack.
thanks a lot.

Using rollup with multiple inputs

Hi

Thanks for the tutorials, couple of points, first a small problem and second a request

  1. rollup -w fails quite frequently with some misc garbage at the ens of bundle.js (duplicated bits of the 'real' content). Stopping the watcher and restarting fixes it but it renders the watch process effectively useless ???

  2. I am unable to figure out how to use rollup in a real project (ie not a toy piece of code) that would involve tens or hundreds of html forms each with its own 'bundle.js'. How do you configure all this ??

Regards

Ron Yuen

CSS is not insert into Head after building

I clone the project and npm install the package. Then npm run build. The css is not bundled into the head of bulid/index.html but into the js/main.min.js using __$styleInject

Babel's "Unexpected token" error

Hi, I'm following the Rollup.js Tutorial, Part 2 (How to Bundle Stylesheets and Add LiveReload With Rollup), and after setting postcss, I get an Unexpected token error from the babel plugin. If I comment the import line for the CSS file, it goes away and everything goes back to green. Are you aware of this? Am I missing something?

replace ENV issue

Running this command:
NODE_ENV=production ./node_modules/.bin/rollup -c
results in the following error:

NODE_ENV=production : The term 'NODE_ENV=production' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1
+ NODE_ENV=production ./node_modules/.bin/rollup -c
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (NODE_ENV=production:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Not sure why - I have all the dependencies etc in there.

js test

Hi,

I tried to run js test with your code by adding a array.spec.js under app-root/test:
import addArray from '../src/modules/mod2';

describe('Object History API Testing', function() {
  
    it('Updating history should change history', function() {
      var res = addArray([1, 2, 3, 4]);
      expect(res).toBe(10);
    });

});

and change a bit in package.json

"test": "cross-env BABEL_ENV=commonjs jest"

added corresponding dependencies, however, it failed with such an error message:
SyntaxError: Unexpected token import

Do you have any idea on it? Or can you add some js test code for the purpose as example?

Thanks in advance!

postcss-cssnext is deprecated

I've been using postcss-cssnext in my project as described in your tutorial for some time and it's been working really well - thanks for that!

Today I rebuilt all my node_modules tree and there was a message that

'postcss-cssnext' has been deprecated in favor of 'postcss-preset-env'. Read more at https://moox.io/blog/deprecating-cssnext/

I tried the migration instructions there without success.

Are you considering updating the tutorial to use postcss-preset-env at all?

I get "but could not be resolved – treating it as an external dependency"

Hi

I want to use roll-up with gulp, but I always get "but could not be resolved – treating it as an external dependency" and in the IIFE the import is treated as external variable.
I'm using gulp, because I want to apply roll-up to multiple entries.

What I'm doing wrong ?

const rollup = require('gulp-rollup');
const resolve = require('rollup-plugin-node-resolve');

gulp.task('rollup', function () {
    return gulp.src('_01_src/js/form/*.js')
        .pipe(rollup({
                entry: '_01_src/js/form/controller.js',
                format: 'iife',
                plugins: [
                    resolve({
                        jsnext: true,
                        main: true,
                        browser: true
                    })
                ]
            })
        )

        .pipe(gulp.dest('_02_build/js/'));
});

React support

I've struggled trying to make react work with rollup.
If you find it useful, here is how I solved it.

It would be useful for others if you put a tip at the end of your post. Or you could push it in a branch here for reference.

`# Clone the repo` not working

$ git clone [email protected]:jlengstorf/learn-rollup.git

will yield

Cloning into 'learn-rollup'...
[...]
Permission denied (publickey).
fatal: Could not read from remote repository.

$ git clone https://github.com/jlengstorf/learn-rollup
works just fine

Minor bug in comment about debug

In your code example you have the following:

// The logger should only be disabled if we’re not in production.
if (ENV !== 'production') {

  // Enable the logger.
  debug.enable('*');
  log('Logging is enabled!');
} else {
  debug.disable();
}

I think if I've understood correctly that the comment should read 'The logger should only be enabled if we're not in production'

ReferenceError

@jlengstorf, thank you very much for creating this great rollup tutorial.

I did not find a way to resolve this error: Uncaught ReferenceError: d3 is not defined, using rollup-plugin-node-resolve and rollup-plugin-commonjs as instructed in your tutorial for avoiding the same error with debug.

I would appreciate any pointers to get around this error (https://github.com/saun4app/hello-d3-es6-rollup).

Thank you very much.

'babel-preset-es2015' module not found

Have any idea? Seems like npm install --save-dev babel-preset-es2015-rollup installed just fine however below still happens.

Node: 4.4.5

C-C02P37U0G3QD:learn-rollup evans.863$ ./node_modules/.bin/rollup -c
{ [Error: Cannot find module 'babel-preset-es2015'] code: 'MODULE_NOT_FOUND' }
Error transforming /Users/evans.863/work/zack/learn-rollup/src/scripts/main.js with 'babel' plugin: Cannot find module 'es2015'
Error: Error transforming /Users/evans.863/work/zack/learn-rollup/src/scripts/main.js with 'babel' plugin: Cannot find module 'es2015'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.require.resolve (internal/module.js:16:19)
    at module.exports (/Users/evans.863/work/zack/learn-rollup/node_modules/babel-preset-es2015-rollup/node_modules/modify-babel-preset/index.js:76:21)
    at Object.<anonymous> (/Users/evans.863/work/zack/learn-rollup/node_modules/babel-preset-es2015-rollup/index.js:3:18)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
Type rollup --help for help, or visit https://github.com/rollup/rollup/wiki

EDIT: My .babelrc is:

{
  "presets": ["es2015-rollup"]
}

Including PostCss results in syntax error

I was going through the tutorial in a more belabored way (not using your git repo, but copying all by hand). Went through part 1 no problems (except a missing dependency of bable-core).

When I try to include postcss i get a syntax error and I do have it in the packages.json file.

missing index.html

I try to follow the tutorial How to Bundle JavaScript With Rollup

When I run ./node_modules/.bin/rollup -c

I'm missing the index.html file in the build directory.

Hence I can't follow the next suggested step:

We can see that the bundle was created properly by opening build/index.html in our browser:

I watched then the video then instead of the text instructions, and have seen, the files was just added to the build folder for demonstration purpose.

It would be a good idea to write that information as well in the text instructions.

That will save some time for people like me.

Struggling

Respect to you, this tutorial must have consumed time and resources beyond the ken of a mere mortal such as I. I wondered could I presume to ask for clarification on some detail?
I have tried to understand all lines of the code and procedure rather than blindly copypasta, the following has me stumped though:
const printTarget = document.getElementsByClassName('debug__output')[0];
does this mean that we are replacing what would have been the debug log output with the results, or am i totally missing something?
Also when would the debug log report something and where? Why not just create a div on the body?

Thanks man you are a legend.

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

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"

Cannot find module 'caniuse-db' 'babel-runtime'

in branch part-3-starter

Starting LiveReload v0.6.2 for /Users/showzyl/Desktop/test/learn-rollup/build on port 35729.
bundling...
node_modules/nan
resolve failed: { Error: Cannot find module 'caniuse-db'
at Function.Module._resolveFilename (module.js:470:15)
at Function.requireRelative.resolve (/Users/showzyl/Desktop/test/learn-rollup/node_modules/require-relative/index.js:30:17)
at resolve (/Users/showzyl/Desktop/test/learn-rollup/node_modules/modify-babel-preset/lib/serialize.js:25:26)
at findAndRemove (/Users/showzyl/Desktop/test/learn-rollup/node_modules/modify-babel-preset/lib/serialize.js:67:11)
at /Users/showzyl/Desktop/test/learn-rollup/node_modules/modify-babel-preset/lib/serialize.js:111:13
at Array.map (native)
at loadPreset (/Users/showzyl/Desktop/test/learn-rollup/node_modules/modify-babel-preset/lib/serialize.js:103:29)
at module.exports (/Users/showzyl/Desktop/test/learn-rollup/node_modules/modify-babel-preset/index.js:97:19)
at Object. (/Users/showzyl/Desktop/test/learn-rollup/node_modules/babel-preset-es2015-rollup/index.js:3:18)
at Module._compile (module.js:571:32) code: 'MODULE_NOT_FOUND' } caniuse-db
resolve failed: { Error: Cannot find module 'babel-runtime'
at Function.Module._resolveFilename (module.js:470:15)
at Function.requireRelative.resolve (/Users/showzyl/Desktop/test/learn-rollup/node_modules/require-relative/index.js:30:17)
at resolve (/Users/showzyl/Desktop/test/learn-rollup/node_modules/modify-babel-preset/lib/serialize.js:25:26)
at findAndRemove (/Users/showzyl/Desktop/test/learn-rollup/node_modules/modify-babel-preset/lib/serialize.js:67:11)
at /Users/showzyl/Desktop/test/learn-rollup/node_modules/modify-babel-preset/lib/serialize.js:111:13
at Array.map (native)
at loadPreset (/Users/showzyl/Desktop/test/learn-rollup/node_modules/modify-babel-preset/lib/serialize.js:103:29)
at module.exports (/Users/showzyl/Desktop/test/learn-rollup/node_modules/modify-babel-preset/index.js:97:19)
at Object. (/Users/showzyl/Desktop/test/learn-rollup/node_modules/babel-preset-es2015-rollup/index.js:3:18)
at Module._compile (module.js:571:32) code: 'MODULE_NOT_FOUND' } babel-runtime
bundled in 1951ms. Watching for changes...

Replace / use specific file based on ENV condition

First off, excellent tutorial on rollup, many thanks!

Quick question, since we are able to replace variables with actual values on an ENV condition I was (hoping) and wondering if the same holds true for files? Say we have two config files with equal properties, and based on the ENV condition, either the /config/environment.dev.ts or the /config/environment.prod.ts replaces the content in the /src/dist/environment.ts file. Any thoughts?

Redundant example:

├── /src/dist/environment.ts (stub, where either the content of {dev} or {prod} is used)

import { environment } from './src/dist/environment';

├── /config/environment.dev.ts

export const environment = {  
  production: false,
  apiUrl : ...,
};

├── /config/environment.prod.ts

export const environment = {  
  production: true,
  apiUrl: ...,
};

The Angular 2 CLI uses the approach described above, the example I use originates here: http://tattoocoder.com/angular-cli-using-the-environment-option/

How do you handle JavaScript errors?

Right now if there is an error thrown in the JavaScript we've to restart the build process manually by running the npm script again. So if I manage to fix the error in my code, Rollup start compiling again. Is there away around this?

Sometimes when it tries to recompile again I get this error:

Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded

Whenever this error pops up I've to restart the script again.

Question about excluding node_modules

I've found your video and associated code examples really useful indeed.

I've got a question on why you need to exclude the 'node_modules' folder when you've explicitly set your entry point as 'src/scripts/main.js' - surely that then means it wouldn't be trying to compile node modules as these are not on that path?

Replace tip

Dunno if this is the right place to this, but...

I have struggled with rollup-plugin-replace for half an hour about it being breaking stuff when I put react in my project when reading/watching https://code.lengstorf.com/learn-rollup-js/

The thing is that by default replace will transform node_modules modules too and in order to avoid it we have to add node_modules/** to the exclude option passed to replace.

You could put a tip in your article in order to help others not being trapped in this situation.

Ty 4 the awesome content.

Get pug loader to work with rollup

Everything is great with the tutorial. But I'm wondering if you can add another one regarding on how to get pug to work with rollup, i've tried all solutions using both rollup-plugin-pug and rollup-plugin-pug-html.

Both doesn't seem to work. Just thought you can expand on that :D

How to require asset file?

Using webpack, we can use file-loader to require a file(json/png/jpg) in js file, then webpack will publish the file to dist.
let zhCNJson = require('file?name=i18n/zh-CN.[hash:8].[ext]!../../i18n/zh-CN.json');
Can rollup do it?

Under Setting ENV, command is different for PowerShell

When going through your article, I was using Visual Studio Code for windows. In that app, it shells out to PowerShell within the application. In order to get the environment setting to work properly, I had to run this:
$env:NODE_ENV="production"; ./node_modules/.bin/rollup -c

When I tired to use your command as outlined below within a regular command window, it did not work, it only set the NODE_ENV variable to be actually "production ./node_modules/.bin/rollup".

NOTE: On Windows, use SET NODE_ENV=production ./node_modules/.bin/rollup -c to avoid an error setting environment variables.

I found this solution via StackOverflow at this location: http://stackoverflow.com/questions/9249830/how-can-i-set-node-env-production-in-windows

ESLint complains about line endings in Windows

I was pretty much following the readme

projects>git clone [email protected]:jlengstorf/learn-rollup.git
projects>cd learn-rollup/
projects\learn-rollup>npm install
...
projects\learn-rollup>npm run dev

> [email protected] dev E:\git\learn-rollup
> rollup -c --watch

checking rollup-watch version...
bundling...

projects\learn-rollup\src\scripts\main.js
   1:55  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   2:29  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   3:1   error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   4:40  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   5:45  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style
   6:39  error  Expected linebreaks to be 'LF' but found 'CRLF'  linebreak-style`
...
36 problems (36 errors, 0 warnings)

error Strings must use singlequote quotes

qq20170109-215502 2x

/**
 * Says hello.
 * @param  {String} name a name
 * @return {String}      a greeting for `name`
 */
export function sayHelloTo( name ) {
  const toSay = `Hello, ${name}!`;

  return toSay;
}

/**
 * Says goodbye.
 * @param  {String} name a name
 * @return {String}      a farewell for `name`
 */
export function sayGoodbyeTo( name ) {
  const toSay = `Later, ${name}!`;

  return toSay;
}

rollup打包时怎么排除第三方组件所引进的样式文件

项目中,import了一个第三方组件的css文件,打包后出现在了输出文件的styleInject里,请问我要怎么排除掉这个样式文件的打包呢
例如:
import 'node_modules/第三方组件/第三方.css';
import styles from './本地的.less';

(uglify) WARN: Output exceeds 32000 characters

Jason et al, I was experimenting with bundling some 3rd party css packages, and ran into this. To reproduce:

npm install material-design-lite --save
# add line to main.js
import '../../node_modules/material-design-lite/material.css';
# production build
export NODE_ENV=production
npm run build
> WARN: Output exceeds 32000 characters

The warning is coming from uglify, but I cannot figure out how or whether is possible to make postcss generate the injected styles with shorter line length. Just for background, this is an issue for both Js and Css files which is why uglify warns about it.

Why are there random line feeds in compiled scripts?
The Closure Compiler intentionally adds line breaks every 500 characters or so. Firewalls and proxies sometimes corrupt or ignore large JavaScript files with very long lines. Adding line breaks every 500 characters prevents this problem. Removing the line breaks has no effect on a script's semantics. The impact on code size is small, and the Compiler optimizes line break placement so that the code size penalty is even smaller when files are gzipped.
https://developers.google.com/closure/compiler/faq#linefeeds

window system using rollup error

hello, when i use npm install babel-preset-es2015-rollup and rollup-plugin-babel there is a error:

.babelrc

{
  "presets": [ "es2015-rollup" ]
}

rollup.config.js

import babel from 'rollup-plugin-babel'
import commonjs from 'rollup-plugin-commonjs'

export default {
  entry: 'src/scripts/main.js',
  dest: 'build/js/main.min.js',
  format: 'umd',
  plugins: [ 
    commonjs(),
    babel({
      exclude: 'node_modules/**',
    }) ]
};

package.json

...
"devDependencies": {
    "babel-preset-es2015-rollup": "^1.2.0",
    "rollup": "^0.34.9",
    "rollup-plugin-babel": "^2.6.1",
    "rollup-plugin-buble": "^0.14.0",
    "rollup-plugin-commonjs": "^5.0.5",
    "rollup-watch": "^2.5.0"
  }
...

and then cmd output a error:

D:\workSpace\git\rollup-learning>npm run dev

> rollup-learning@1.0.0 dev D:\workSpace\git\rollup-learning
> rollup -c --watch

checking rollup-watch version...
bundling...
**Error transforming D:\workSpace\git\rollup-learning\src\scripts\main.js with 'babel' plugin: It look
s like your Babel configuration specifies a module transformer. Please disable it. If you're using t
he "es2015" preset, consider using "es2015-rollup" instead. See https://github.com/rollup/rollup-plu
gin-babel#configuring-babel for more information**
Error: Error transforming D:\workSpace\git\rollup-learning\src\scripts\main.js with 'babel' plugin:
It looks like your Babel configuration specifies a module transformer. Please disable it. If you're
using the "es2015" preset, consider using "es2015-rollup" instead. See https://github.com/rollup/rol
lup-plugin-babel#configuring-babel for more information
    at preflightCheck (D:\workSpace\git\rollup-learning\node_modules\rollup-plugin-babel\dist\rollup
-plugin-babel.cjs.js:43:102)
    at Object.transform$1 [as transform] (D:\workSpace\git\rollup-learning\node_modules\rollup-plugi
n-babel\dist\rollup-plugin-babel.cjs.js:104:18)
    at D:\workSpace\git\rollup-learning\node_modules\rollup\src\utils\transform.js:19:35
Type rollup --help for help, or visit https://github.com/rollup/rollup/wiki

D:\workSpace\git\rollup-learning>

waiting online !

It looks like your Babel configuration specifies a module transformer.

Got this error:

projects\learn-rollup>npm run dev
Error transforming projects\src\scripts\main.js with 'babel' plugin: It looks like your Babel configuration specifies a module transformer. Please disable it. If you're using the "es2015" preset, consider using "es2015-rollup" instead. See https://github.com/rollup/rollup-plugin-babel#configuring-babel for more information

That page suggests this .babelrc

{
  "presets": [
    [
      "es2015",
      {
        "modules": false
      }
    ]
  ],
  "plugins": [
    "external-helpers"
  ]
}

Even with that config, I couldn't get modules & es6 working.

Babel's "Unexpected token error

Please note that this is not a support forum for Rollup. If your issue is not directly related to the tutorial code, this is NOT the right place to open an issue.

If you are getting Rollup errors with a particular module, try opening an issue on that module's repo first.

If you are getting Rollup errors with multiple modules, open an issue on the Rollup repo: https://github.com/rollup/rollup

Thanks!

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.