diff --git a/gulp/.babelrc b/gulp/.babelrc new file mode 100644 index 00000000..a0765e18 --- /dev/null +++ b/gulp/.babelrc @@ -0,0 +1,3 @@ +{ + "presets": ["es2015"] +} diff --git a/gulp/babel-es6.config.js b/gulp/babel-es6.config.js index e687f070..b3f088f9 100644 --- a/gulp/babel-es6.config.js +++ b/gulp/babel-es6.config.js @@ -10,7 +10,6 @@ module.exports = function (api) { loose: true, spec: false, modules: "auto", - // debug: true }, ], ]; diff --git a/gulp/babel.config.js b/gulp/babel.config.js index 0552a94b..44d47d17 100644 --- a/gulp/babel.config.js +++ b/gulp/babel.config.js @@ -4,18 +4,24 @@ module.exports = function (api) { [ "@babel/preset-env", { - targets: "android >= 4.4.4", + targets: "cover 99.5%", useBuiltIns: "usage", corejs: 3, loose: true, spec: false, modules: "auto", - // debug: true }, ], ]; const plugins = [ "closure-elimination", + // var is faster than let and const! + [ + "@babel/plugin-transform-block-scoping", + { + throwIfClosureRequired: false, + }, + ], [ "@babel/plugin-transform-classes", { diff --git a/gulp/webpack.production.config.js b/gulp/webpack.production.config.js index e06e15c1..fab5dbeb 100644 --- a/gulp/webpack.production.config.js +++ b/gulp/webpack.production.config.js @@ -61,7 +61,8 @@ module.exports = ({ // Display bailout reasons optimizationBailout: true, }, - devtool: "source-map", + // devtool: "source-map", + devtool: false, resolve: { alias: { "global-compression": path.resolve(__dirname, "..", "src", "js", "core", "lzstring.js"), @@ -85,7 +86,7 @@ module.exports = ({ minimizer: [ new TerserPlugin({ parallel: true, - sourceMap: true, + sourceMap: false, cache: false, terserOptions: { ecma: es6 ? 6 : 5, @@ -178,6 +179,10 @@ module.exports = ({ patterns: ["../src/js/**/*.js"], }), + // new webpack.SourceMapDevToolPlugin({ + // filename: "[name].map", + // publicPath: "/v/" + utils.getRevision() + "/", + // }), // new ReplaceCompressBlocks() // new webpack.optimize.ModuleConcatenationPlugin() // new WebpackDeepScopeAnalysisPlugin() @@ -242,13 +247,23 @@ module.exports = ({ }, { test: /\.worker\.js$/, - use: { - loader: "worker-loader", - options: { - fallback: false, - inline: true, + use: [ + { + loader: "worker-loader", + options: { + fallback: false, + inline: true, + }, }, - }, + { + loader: "babel-loader?cacheDirectory", + options: { + configFile: require.resolve( + es6 ? "./babel-es6.config.js" : "./babel.config.js" + ), + }, + }, + ], }, { test: /\.md$/, diff --git a/src/js/webworkers/background_animation_frame_emittter.worker.js b/src/js/webworkers/background_animation_frame_emittter.worker.js index 5a3fe5c9..c927b2d3 100644 --- a/src/js/webworkers/background_animation_frame_emittter.worker.js +++ b/src/js/webworkers/background_animation_frame_emittter.worker.js @@ -1,12 +1,12 @@ // We clamp high deltas so 30 fps is fairly ok -const bgFps = 30; -const desiredMsDelay = 1000 / bgFps; +var bgFps = 30; +var desiredMsDelay = 1000 / bgFps; let lastTick = 0; function tick() { - const now = performance.now(); - const delta = now - lastTick; + var now = performance.now(); + var delta = now - lastTick; lastTick = now; // @ts-ignore