You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
importpathfrom'node:path';importtype{Configuration}from'webpack';import{rules}from'./webpack.rules';importWebpackObfuscatorfrom'webpack-obfuscator';exportconstmainConfig: 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 heremodule: {
rules
},plugins: [newWebpackObfuscator({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/6698055alias: {"@domain": path.resolve(__dirname,"src/domain"),"@platform": path.resolve(__dirname,"src/platform"),"@build_src": path.resolve(__dirname,"build_src")}}};
Using loader
importtype{ModuleOptions}from'webpack';importWebpackObfuscatorfrom'webpack-obfuscator';importpathfrom'node:path'exportconstrules: 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 loadersuse: {loader: WebpackObfuscator.loader,options: {rotateStringArray: true,renameProperties: true}}}];
How can I force WebPack to process only my own code without touching any dependencies?
The text was updated successfully, but these errors were encountered:
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
Using loader
How can I force WebPack to process only my own code without touching any dependencies?
The text was updated successfully, but these errors were encountered: