Skip to content

Commit

Permalink
fix(bundle): Rollup: Do not warn on THIS_IS_UNDEFINED
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Sep 30, 2017
1 parent c028447 commit a4581b1
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,31 @@ import progress from 'rollup-plugin-progress';
import sourcemaps from 'rollup-plugin-sourcemaps';
import visualizer from 'rollup-plugin-visualizer';

var MINIFY = process.env.MINIFY;
const MINIFY = process.env.MINIFY;

var pkg = require('./package.json');
var banner =
const pkg = require('./package.json');
const banner =
`/**
* ${pkg.description}
* @version v${pkg.version}
* @link ${pkg.homepage}
* @license MIT License, http://www.opensource.org/licenses/MIT
*/`;

var uglifyOpts = { output: {} };
const uglifyOpts = { output: {} };
// retain multiline comment with @license
uglifyOpts.output.comments = (node, comment) =>
comment.type === 'comment2' && /@license/i.test(comment.value);

var plugins = [
const onwarn = (warning) => {
// Suppress this error message... https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
const ignores = ['THIS_IS_UNDEFINED'];
if (!ignores.some(code => code === warning.code)) {
console.error(warning.message);
}
};

const plugins = [
nodeResolve({jsnext: true}),
progress({ clearLine: false }),
sourcemaps(),
Expand All @@ -29,7 +37,7 @@ var plugins = [

if (MINIFY) plugins.push(uglify(uglifyOpts));

var extension = MINIFY ? ".min.js" : ".js";
const extension = MINIFY ? ".min.js" : ".js";

const CONFIG = {
moduleName: '@uirouter/core',
Expand All @@ -41,6 +49,7 @@ const CONFIG = {
exports: 'named',
plugins: plugins,
banner: banner,
onwarn: onwarn,
};

export default CONFIG;

0 comments on commit a4581b1

Please sign in to comment.