Closed chesnokovsergei closed 4 years ago
Did you end up fixing this?
Hi. At first, rotateUnicodeArray
is the old option name and it has been renamed a few years ago to the rotateStringArray
Hey!
plugins: [ new WebpackObfuscator({ rotateStringArray: true, }), ],
This is inside of our webpack.config.js
, and when we run webpack --production
, the output bundles are not obfuscated.
Webpack Version: 4.44.0 Webpack Obfuscator Version: 1.8.3
Thanks!
Can you create the repository with a simple reproducible example?
Also, output bundles have .js
extension?
Yes, the output bundles are .js
. I'll have an example up in a few minutes, just need to make sure everything is replicated correctly!
Ok, here's the example repo (on the webpack-obfuscator-example branch): https://github.com/joshverd/react-boilerplate-template/tree/webpack-obfuscator-example
First, run npm i
then run npm run build-frontend
to execute the local webpack build production command. The output bundle goes to /public/bundle.js
, but it doesn't change if you add/remove the WebpackObfuscatorPlugin
plugin.
Let me know if you have any questions!
EDIT: This repo has an example frontend built with Typescript, but it's acting the same with my other private, non-typescript project, which is where we first encountered the issue.
It works for me
Try to remove your package-lock.json
file and completely reinstall your dependencies.
My javascript-obfuscator
version is the same as yours.
I removed package-lock.json
and node_modules
, then ran npm i
. Still isn't working.
I'm going to dig into the source further and see where stuff is going wrong. I'll post an update here when I've done that.
Alright, I uninstalled all my globally-installed npm packages and that fixed it. I think it was using a different webpack/webpack-cli version than it should have been when building the bundle.
Thanks for your help with this issue!
Nice!
@chesnokovsergei i'll close this issue. Please write here if your problem still exist.
I'm going to respond here just in case anyone stumbles upon this issue in the future.
My private project had a different issue. In our webpack.config.js, we had the following config:
output: {
path: path.resolve("public"),
filename: '[name].[chunkhash].js?hash=[chunkhash]',
chunkFilename: "[name].[chunkhash].js?hash=[chunkhash]",
},
When webpack-obfuscator looks at each chunk/file name, it checks to see if the file NAMES end in .js
, which means that if the ?hash=
query param is set, it think it's not a JS file, and won't run it through the obfuscator.
Anyway, thanks again for your help. You can close this issue again! :)
I'm going to respond here just in case anyone stumbles upon this issue in the future.
My private project had a different issue. In our webpack.config.js, we had the following config:
output: { path: path.resolve("public"), filename: '[name].[chunkhash].js?hash=[chunkhash]', chunkFilename: "[name].[chunkhash].js?hash=[chunkhash]", },
When webpack-obfuscator looks at each chunk/file name, it checks to see if the file NAMES end in
.js
, which means that if the?hash=
query param is set, it think it's not a JS file, and won't run it through the obfuscator.Anyway, thanks again for your help. You can close this issue again! :)
looks like a bug. Have to use regexp
Any fix on this issue?
I forked the webpack v4-compatible version and added the hash fix: https://github.com/joshverd/webpack-obfuscator
nice one thanks, webpack v5 official version is having same problem too. they didnt fix it yet.
Note for exclude fix; ['**/chunk-vendors.js?hash=**']
Hello,
It's perfect package I used it sometimes ago. But today I have launched it with pure boilerplate and it doesn't work. My js files haven't been changed. Maybe I miss something from docs. If it is necessary I can attach git repo. This is my webpack.config.js
package.json
.babelrc:
Thanks a lot.