getkey / rollup-plugin-obfuscator

The most powerful rollup plugin for javascript-obfuscator.
Mozilla Public License 2.0
117 stars 9 forks source link

[Suggestion] A way to add a header to the generated bundle #25

Open GeekCornerGH opened 8 months ago

GeekCornerGH commented 8 months ago

I appologie if this is the wrong place to make feature requests, I couldn't find any other fitting place.

I'm required to run the plugin in enforce: "post" mode, because I'm using some import.meta.env and it would break otherwise. Sadly, I can't add a header to the generated bundle, as I can't manage to get a custom-written vite plugin to execute after obfuscator has done its work.

So what about adding an option which would add a header to the js bundle?

Regards

getkey commented 8 months ago

Salut, could you give me an example of what you would put in that header? I'm sure there are other plugins to add headers, that you would be able to use also with post, but defined in your config after this plugin.

But I think since you are using import.meta.env, most likely the solution you are actually looking for is this one: https://github.com/getkey/rollup-plugin-obfuscator/issues/11#issuecomment-1426468581 :slightly_smiling_face:

GeekCornerGH commented 8 months ago

I'd add something like copyright text or so like

/*
Copyright someName 2024, all right reserved
/*
console.log("Hello world"); // Placeholder for actual code

I tried changing the order of the plugins, yet this doesn't works