Describe the bug
NextJs Compress mode or Minify process is disabled when enable JsAst.
To Reproduce
Steps to reproduce the behavior:
Local:
Turn enableJsAst to true in next-css-obfuscator.config.cjs
npm run build in Terminal
Check every js file in .next/static
See error (not minified)
Deploy to Vercel (thru GitHub repo case):
Turn enableJsAst to true in next-css-obfuscator.config.cjs
Commit to GitHub
After successfull deploy in Vercel, visit the website
Ctrl + U or right click -> View page source
Ctrl + Shift + R to hard reload
Find and click a .js file in the window
Ctrl + Shift + R multiple times to hard reload again (Just to be sure)
See error (not minified)
Expected behavior
Screenshots
Config
module.exports = {
enable: true, // Enable or disable the plugin.
mode: "random", // Obfuscate mode, "random" or "simplify".
buildFolderPath: ".next", // Build folder of your project.
classConversionJsonFolderPath: "./css-obfuscator", // The folder path to store the before obfuscate and after obfuscated classes conversion table.
refreshClassConversionJson: false, // Refresh the class conversion JSON file.
classLength: 6, // Length of the obfuscated class name.
classPrefix: "n", // Prefix of the obfuscated class name.
classSuffix: "", // Suffix of the obfuscated class name.
classIgnore: [
"dark",
"light",
"no-transition",
"opa-hidden",
"big",
"small",
/os-scrollbar*/,
], // The class names to be ignored during obfuscation.
allowExtensions: [".jsx", ".tsx", ".js", ".ts", ".html", ".rsc"], // The file extensions to be processed.
contentIgnoreRegexes: [/\.jsxs\)\("\w+"/g], // The regexes to match the file content to be ignored during obfuscation.
whiteListedFolderPaths: [], // Only obfuscate files in these folders
blackListedFolderPaths: ["./.next/cache"], // Don't obfuscate files in these folders
enableMarkers: false, // Enable or disable the obfuscate marker classes.
markers: ["obf"], // Classes that indicate component(s) need to obfuscate.
removeMarkersAfterObfuscated: true, // Remove the obfuscation markers from HTML elements after obfuscation.
removeOriginalCss: true, // Delete original CSS from CSS files if it has a obfuscated version.
generatorSeed: 84817818898, // The seed for the random generator.
//! Experimental feature
enableJsAst: true, // Whether to obfuscate JS files using abstract syntax tree parser (Experimental feature)
logLevel: "info", // Log level
};
Related files
Demos (if any)
N/A
Additional context
I'm not sure if JsAst new mode does anything different than without it enabled, even though I've read the documentation, but maybe it's giving an error now.
Type
Checklist
Environment
Describe the bug NextJs
Compress mode
orMinify process
is disabled when enableJsAst
.To Reproduce Steps to reproduce the behavior:
enableJsAst
totrue
innext-css-obfuscator.config.cjs
npm run build
inTerminal
js file
in.next/static
enableJsAst
totrue
innext-css-obfuscator.config.cjs
Commit
to GitHubCtrl + U
orright click -> View page source
Ctrl + Shift + R
to hard reload.js
file in the windowCtrl + Shift + R
multiple times to hard reload again (Just to be sure)Expected behavior
Screenshots
Config
Related files
Demos (if any) N/A
Additional context I'm not sure if
JsAst
new mode does anything different than without it enabled, even though I've read the documentation, but maybe it's giving an error now.