Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uglifier issue: Extra configuration is required for Uglifier 3.x to support ES6 in production mode (it is supported in development mode) #2755 #652

Open
improvethings opened this issue Dec 19, 2020 · 1 comment

Comments

@improvethings
Copy link

improvethings commented Dec 19, 2020

Minimal Mistakes version: 4.21.0
Ruby gem or remote theme version: 2.7.6.2
Jekyll version: 3.8.7
uglifier 4.2.0
Operating system: Debian 10 (Buster) on Linux 5.4.0-0.bpo.4-amd64 x86_64

Publishing website to Vercel from github.

Description

Downstream issue for reference

Steps

$ JEKYLL_ENV=production bundle exec jekyll serve

Output

...
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
jekyll 3.8.7 | Error: Unexpected token: keyword (const). To use ES6 syntax, harmony mode must be enabled with Uglifier.new(:harmony => true).
=> const fs = require("fs");
2 const pkg = require("./package.json");
3 const filename = "assets/js/main.min.js";
4 const script = fs.readFileSync(filename);
5 const padStart = str => ("0" + str).slice(-2);
6 const dateObj = new Date();
7 const date = ${dateObj.getFullYear()}-${padStart( 8 dateObj.getMonth() + 1 9 )}-${padStart(dateObj.getDate())};

Expected

Same output at when I run $ bundle exec jekyll serve

(brings up production environment on local webserver)

@Yankie
Copy link
Contributor

Yankie commented Mar 9, 2021

I'll save you some time :)
Add following in your _config.yml:

jekyll-minifier:
  uglifier_args:
    harmony: true

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants