Skip to content

Commit

Permalink
Switch to using terser instead of babel
Browse files Browse the repository at this point in the history
Babel has this bug which appeared after trying to update to the latest version, and remained even after rolling back to an older version.  Extremely annoying.  babel/minify#974
Add grunt-terser.
Remove babel, core-js, lodash, which was used just once in build-popup.js, and react-virtualized, which wasn't used at all.
Remove package-lock.json from .gitignore and commit it, to make it easier to track exact package changes.
  • Loading branch information
fwextensions committed Mar 29, 2021
1 parent e6efa20 commit 03a044f
Show file tree
Hide file tree
Showing 5 changed files with 13,631 additions and 21 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@
/build/rjs
/build/out
/node_modules
/package-lock.json
/release
11 changes: 2 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,7 @@ module.exports = function(grunt) {
}
},

babel: {
options: {
shouldPrintComment: (val) => /@license|@preserve|\/\*!/.test(val),
comments: false,
minified: true,
compact: true,
sourceMaps: false
},
terser: {
rjs: {
files: {
"build/out/js/common/error-handler.js": "src/js/lib/error-handler.js",
Expand Down Expand Up @@ -362,7 +355,7 @@ module.exports = function(grunt) {
`cleanupManifest:${target}:${env}`,
"buildPopup",
"requirejs",
"babel",
"terser",
"sync:build",
"clean:rjs"
]);
Expand Down
6 changes: 2 additions & 4 deletions build/scripts/build-popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ const ReactDOMServer = require("react-dom/server");
const React = require("react");
const requirejs = require("requirejs");
const fs = require("fs");
const _ = require("lodash");


const ConfigPattern = /({[\s\S]+})/m;
Expand All @@ -13,7 +12,6 @@ const configFile = fs.readFileSync("./src/js/require-config.js", "utf8");
const currentPopupHTML = fs.readFileSync("./src/popup.html", "utf8");
const currentReactMarkup = currentPopupHTML.match(RootPattern)[1];
const match = configFile.match(ConfigPattern);
let config;


if (!match) {
Expand All @@ -31,11 +29,11 @@ navigator = {
};

// we have to wrap the bare object in parens to eval it
config = eval("(" + match[1] + ")");
const config = eval("(" + match[1] + ")");

// switch some of the libraries to mocked versions so that we can require
// the App component outside of a browser
config.paths = _.assign(config.paths, {
config.paths = Object.assign(config.paths, {
cp: "../../build/mock/cp",
// the mock tracker needs to create a window global and then require
// the original tracker module
Expand Down
Loading

0 comments on commit 03a044f

Please sign in to comment.