camelaissani / rollup-plugin-closure-compiler-js Goto Github PK
View Code? Open in Web Editor NEWRollup plugin for optimizing JavaScript with google-closure-compiler-js.
License: MIT License
Rollup plugin for optimizing JavaScript with google-closure-compiler-js.
License: MIT License
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
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.
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;
}
}
}
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?
The version in dependencies is a bit outdated. Not sure the ^
here is much use, as the compiler doesn't use semver. Use *
perhaps?
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.
This code causes the generation of corrupted source map:
import result from './export-number.js';
console.log(result);
This plugin has not been validated on windows so far
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.