javascript-obfuscator / javascript-obfuscator/webpack-obfuscator

help with excluding a 10mb file from obfuscation

オープン
#164 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
TypeScript
スター
928
フォーク
92
PR マージ指標
30日以内にマージされた PR はありません

説明

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?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず、報告された `foe-info-low-webpack.config.js` と、除外設定の方法について `webpack-obfuscator` のドキュメントを確認します。報告では、`src/js/data/cityEntities.js` を追加した後、`WebpackObfuscator` の処理中にビルドが 92% で停止するとされています。そのファイルが引き続き処理されているかを確認し、そのデータを含めた `npm run build-lowtool` が正常に完了することを確認してください。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, typescript, webpack
領域
build-system
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。