javascript-obfuscator / javascript-obfuscator/webpack-obfuscator

help with excluding a 10mb file from obfuscation

Đang mở
#164 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
928
Fork
92
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

hi guys, i'v been having trouble building my chrome extension ever since i included a 10mb file that contains the data about all event buildings in a video game ... before i was able to dynamically load it, but now dynamic loading doesn't work for me as the game itself changed something, so as a temporary fix i downloaded the file and placed it in /src/js/data/cityEntities.js ... ever since doing that, when i run npm run build-lowtool the build gets stuck at:
```
❯ npm run build-lowtool

> FoE-Info@0.0.80 build-lowtool
> webpack --config foe-info-low-webpack.config.js

92% sealing asset processing WebpackObfuscator
```

while when i revert the inclusion of that file, the build builds succesfully ...

so i'v looked up trough your readme on how to exclude a file from obfuscation, and did exactly that ... but still my build process gets stuck at 92% and takes forever to do it ...

this is my foe-info-low-webpack.config.js
```
var webpack = require("webpack"),
path = require("path"),
fileSystem = require("fs");

const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const WebpackExtensionManifestPlugin = require("webpack-extension-manifest-plugin");
const baseManifest = require("./src/chrome/manifest-low.json");
const pkg = require("./package.json");
const TerserPlugin = require("terser-webpack-plugin");
var JavaScriptObfuscator = require("webpack-obfuscator");
var ZipPlugin = require("zip-webpack-plugin");

const PACKAGE_NAME = "LoW-Tool";
const date = new Date().toISOString().substr(0, 10);

// const PUBLIC_PATH = process.env.PUBLIC_PATH || '/';

module.exports = {
mode: "production",
optimization: {
minimize: true,
minimizer: [
new TerserPlugin({
terserOptions: {
ecma: 6,
parse: {},
compress: {
pure_funcs: ["console.info", "console.debug"],
},
format: {
comments: false,
},
mangle: true,
module: true,
// Deprecated
output: null,
format: null,
toplevel: false,
nameCache: null,
ie8: false,
keep_classnames: false,
keep_fnames: false,
safari10: false,
},
extractComments: false,
}),
],
},
entry: {
app: "./src/extras/index.js",
options: "./src/js/options.js",
devtools: "./src/js/devtools.js",
popup: "./src/js/popup.js",
},
module: {
rules: [
{
test: /\.js$/,
exclude: path.resolve(__dirname, "/node_modules", "/src/js/data/cityEntities.js"),
// `.swcrc` can be used to configure swc
},
{
test: /\.(sa|sc|c)ss$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "postcss-loader", "sass-loader"],
},
{
test: /\.(png|svg|jpg|gif)$/,
use: ["file-loader"],
},
],
},
output: {
filename: "[name].js",
chunkFilename: "[name].js",
path: path.resolve(__dirname, "build/" + PACKAGE_NAME),
publicPath: "/",
},
plugins: [
new MiniCssExtractPlugin(),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
}),
new webpack.ProgressPlugin(),
// clean the build folder
new CleanWebpackPlugin({
verbose: true,
cleanStaleWebpackAssets: true,
}),
new webpack.DefinePlugin({
// Definitions...
EXT_NAME: JSON.stringify(PACKAGE_NAME),
DEV: false,
}),
new HtmlWebpackPlugin({
title: PACKAGE_NAME,
manifest: "manifest.json",
filename: "panel.html",
template: "./src/chrome/panel.html",
chunks: ["app"],
hash: true,
}),
new HtmlWebpackPlugin({
title: PACKAGE_NAME,
filename: "options.html",
template: "./src/chrome/options.html",
chunks: ["options"],
}),
new HtmlWebpackPlugin({
title: PACKAGE_NAME,
filename: "popup.html",
template: "./src/chrome/popup.html",
chunks: ["popup"],
}),
new HtmlWebpackPlugin({
title: PACKAGE_NAME,
filename: "devtools.html",
template: "./src/chrome/devtools.html",
chunks: ["devtools"],
}),
new CopyPlugin({
patterns: [
{
from: "node_modules/webextension-polyfill/dist/browser-polyfill.min.js",
},
{ from: "./src/i18n", to: "i18n" },
{ from: "./src/icons/common", to: "icons" },
{ from: "./src/icons/foe-info-low", to: "icons" },
{ from: "src/images/logo90.png", to: "icons/" },
],
}),
new WebpackExtensionManifestPlugin({
config: {
base: baseManifest,
extend: {
version: pkg.version,
name: PACKAGE_NAME,
short_name: PACKAGE_NAME,
},
},
}),
new JavaScriptObfuscator(
{
compact: true,
controlFlowFlattening: true,
controlFlowFlatteningThreshold: 0.75,
deadCodeInjection: true,
deadCodeInjectionThreshold: 0.4,
disableConsoleOutput: true,
identifierNamesGenerator: "hexadecimal",
log: false,
numbersToExpressions: true,
renameGlobals: true,
rotateStringArray: true,
selfDefending: true,
shuffleStringArray: true,
simplify: true,
splitStrings: true,
splitStringsChunkLength: 10,
stringArray: true,
stringArrayEncoding: ["base64"],
stringArrayThreshold: 0.75,
transformObjectKeys: true,
unicodeEscapeSequence: false,
},
["excluded_bundle_name.js"]
),
new ZipPlugin({
// OPTIONAL: defaults to the Webpack output path (above)
// can be relative (to Webpack output path) or absolute
path: "../",

// OPTIONAL: defaults to the Webpack output filename (above) or,
// if not present, the basename of the path
filename: PACKAGE_NAME + "_" + pkg.version + "_" + date + ".zip",
}),
],
resolve: {
extensions: [".tsx", ".ts", ".js"],
fallback: {
fs: false,
},
},
};
```
I'd appreciate any help making the build process actually work, did i exclude /src/js/data/cityEntities.js the proper way?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Hướng nghiên cứu

Bắt đầu bằng cách xem xét `foe-info-low-webpack.config.js` được báo cáo và tài liệu của `webpack-obfuscator` về cách cấu hình các mục loại trừ. Báo cáo cho biết quá trình build bị dừng ở mức 92% trong `WebpackObfuscator` sau khi thêm `src/js/data/cityEntities.js`; hãy xác định xem tệp này có vẫn đang được xử lý hay không và xác nhận `npm run build-lowtool` chạy thành công khi bao gồm dữ liệu đó.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
javascript, typescript, webpack
Lĩnh vực
build-system
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
35/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.