GithubHelp home page GithubHelp logo

camelaissani / rollup-plugin-closure-compiler-js Goto Github PK

View Code? Open in Web Editor NEW
31.0 3.0 5.0 19 KB

Rollup plugin for optimizing JavaScript with google-closure-compiler-js.

License: MIT License

JavaScript 100.00%
minify closure compiler rollup rollup-plugin closure-compiler

rollup-plugin-closure-compiler-js's Introduction

rollup-plugin-closure-compiler-js

license Build Status dependencies Status devDependencies Status

latest version npm

Rollup plugin for optimizing JavaScript with google-closure-compiler-js.

Install

npm i rollup-plugin-closure-compiler-js -D

Usage

import { rollup } from 'rollup';
import closure from 'rollup-plugin-closure-compiler-js';

rollup({
    entry: 'main.js',
    plugins: [
        closure()
    ]
});

See closure-compiler-js documentation for more information about options.

License

MIT ©

rollup-plugin-closure-compiler-js's People

Contributors

camelaissani avatar jdonaldson10 avatar tschaub avatar wardpeet 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

Watchers

 avatar  avatar  avatar

rollup-plugin-closure-compiler-js's Issues

peerDependency?

A frustration of this plug-in is that it brings in its own dependency of the underlying google-closure-compiler library, currently it is using version 20160916.0.0 instead of the much newer version already in my project. Typically the solution for this is a peer dependency, to use whatever version is already in the project rather than install one zone.

How about switching to a peer dependency?

Working with other plugins?

Hi, I've got a rollup build which involves the TypeScript, commonjs and node-resolve plugins. What's the best way to have the closure plugin work with them? Right now it's breaking on some require statements which I'm supposing should have been handled by the commonjs plugin.

Error in plugin due to invalid transpilation

Compiling a large project, I encountered the following error:

Error: (closure-compiler-js plugin) Error transforming bundle with 'closure-compiler-js' plugin: cand is not defined

Searching the plugin, I identified the following issue in the plugin, in dist/rollup-plugin-closure-compiler-js*.js (both files):

      for (var _iterator = inputFiles[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
        var _file = _step.value;

        if (cand.path == _file) { // <---- ?! undefined variable cand
          return cand;
        }
      }

Referencing the original ES6 source (https://github.com/google/closure-compiler-js/blob/master/logger.js), it's clear that something has gone wrong with the transpilation:

    // Filenames are the same across source and externs, so prefer source files.
    for (const files of [options.jsCode, options.externs]) {
      if (!files) { continue; }

      for (const cand of files) {
        if (cand.path == file) {
          return cand;
        }
      }
    }

Fails when there is ES6 getter in source

I noticed that this code fails to be compiled:

export class Route {
    constructor(uriPart) {
        this.uriPart = uriPart;
    }

    get uri() {
        return this.uriPart;
    }
}

export class Router {};

Because of the ES6 get synthax

Why it is expecting a semi colon?

When rolling up with your plugin I see this error

└─( 2 ) ❱❱❱ yarn build                                                                      1 ⏎  +2502 19:27 ❰─┘
yarn build v0.24.6
$ npm run std --silent
$ rollup -c env/prod/rollup.config.js 
100% (748): src/wrappers/optionsWrapper.js⚠️   'default' is not exported by 'node_modules/buffer-es6/index.js'
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module
commonjs-proxy:/home/michael-heuberger/code/videomail-client/node_modules/buffer-es6/index.js (1:137)
1: import * as index from "/home/michael-heuberger/code/videomail-client/node_modules/buffer-es6/index.js"; export default ( index && index['default'] ) || index;
                                                                                                                                            ^

Input_0:1 (JSC_PARSE_ERROR)
Parse error. Semi-colon expected
var videomail-client = (function () {
             ^
'use strict';

function createCommonjsModule(fn, module) {
	return module = { exports: {} }, fn(module, module.exports), module.exports;

🚨   (closure-compiler-js plugin) Error transforming bundle with 'closure-compiler-js' plugin: compilation error, 1 error

error Command failed with exit code 1.

To reproduce, git clone this branch https://github.com/binarykitchen/videomail-client/tree/feature/rollupjs and do yarn build

Any tips would be very much appreciated.

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.