How to onfuscate only my own code using webpack-obfuscator?
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- electron, typescript, webpack
- 领域
- build-system, desktop
调研方向
从 webpack 主配置和 webpack.rules 中的规则开始,重点检查针对捆绑模块的插件和加载器匹配项。运行 Electron webpack 构建并检查其输出,以确定哪些模块已被混淆。完成的标准是:应用自身的 TypeScript 代码经过处理,而第三方依赖保持不变。
由索引模型根据 Issue 内容生成。
描述
I'm building an electron application using TypeScript and WebPack. I want to process my own code without touching any 3rd party dependencies in order to rename only my own classes property names.
I've tried to use two approaches but with no success:
-
Using plugin
import path from 'node:path'; import type { Configuration } from 'webpack'; import { rules } from './webpack.rules'; import WebpackObfuscator from 'webpack-obfuscator'; export const mainConfig: Configuration = { /** * This is the main entry point for your application, it's the first file * that runs in the main process. */ entry: "./src/index.ts", // Put your normal webpack config below here module: { rules }, plugins: [ new WebpackObfuscator({ sourceMap: true, renameProperties: true, rotateStringArray: true }, "node_modules/") ], resolve: { extensions: [".js", ".ts", ".jsx", ".tsx", ".css", ".json"], // Workaround to make import aliases ("paths" from tscondig.json) work // https://stackoverflow.com/a/75373097/6698055 alias: { "@domain": path.resolve(__dirname, "src/domain"), "@platform": path.resolve(__dirname, "src/platform"), "@build_src": path.resolve(__dirname, "build_src") } } }; -
Using loader
import type { ModuleOptions } from 'webpack'; import WebpackObfuscator from 'webpack-obfuscator'; import path from 'node:path' export const rules: Required<ModuleOptions>["rules"] = [ // Add support for native node modules { // We're specifying native_modules in the test because the asset relocator loader generates a // "fake" .node file which is really a cjs file. test: /native_modules[/\\].+\.node$/, use: "node-loader" }, { test: /[/\\]node_modules[/\\].+\.(m?js|node)$/, parser: { amd: false }, use: { loader: "@vercel/webpack-asset-relocator-loader", options: { outputAssetBase: "native_modules" } } }, { test: /\.js$/, enforce: 'post', // Ensure this loader will be called after normal loaders use: { loader: WebpackObfuscator.loader, options: { rotateStringArray: true, renameProperties: true } } } ];
How can I force WebPack to process only my own code without touching any dependencies?
- 主要语言
- TypeScript
- 星标
- 930
- 派生
- 92
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
javascript-obfuscator/webpack-obfuscator 的其他 Issue
-
难度 4/5 3-5 天 新手友好度 25/100
-
难度 4/5 3-5 天 新手友好度 35/100
javascript-obfuscator/webpack-obfuscator#180 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 35/100
-
难度 3/5 1-2 天 新手友好度 35/100
-
The built product will be recognized as a virus by the latest Windows 11 virus library and removed未关闭
难度 4/5 3-5 天 新手友好度 25/100
javascript-obfuscator/webpack-obfuscator#176 · 1 条评论 ·
查看 javascript-obfuscator/webpack-obfuscator 的全部 Issue
相似的 Issue
-
Remove unused dependencies可能已有人在做 @alastair-smith 今天认领。 未关闭chore other
难度 2/5 1-3 小时 新手友好度 78/100
alastair-smith/card-games#384 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
code-yeongyu/senpi#5571 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
nexu-io/open-design#9262 · 1 条评论 ·
维护者通常 1 天内回复
-
friction
难度 2/5 1-3 小时 新手友好度 72/100
kentcdodds/kody#4753 ·
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
难度 1/5 1 小时以内 新手友好度 62/100
lingdojo/kana-dojo#33508 · 1 条评论 · 5 个 reaction ·
维护者通常 1 天内回复