javascript-obfuscator / javascript-obfuscator/webpack-obfuscator

Exclude files

Abierto
#166 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
TypeScript
Estrellas
928
Forks
92
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

Hello all,

I have used webpack obfuscator previous version for webpack 4 with laravel mix. Now I have been trying this version and it works great, but when it tried to build the service worker always gives me an error saying that it cant find the self.__manifest. I realized that probably some files are being obfuscated and they should not. So, I decided to exclude the files that I was excluding before, but after trying some things, reading the docs and look to the webpackObfuscatorPlugin class and apply what it looks like its the correct way I am not being able to exclude the files I want.

This is the block of code that I am using:
```
if (mix.inProduction()) {
/**
* PWA code
*/
mix.injectManifest({
swSrc: './resources/js/service-worker.js',
swDest: path.join(`${__dirname}/public`, 'service-worker.js'),
mode: 'production',
});

mix.webpackConfig({
plugins: [
new WebpackObfuscator({
//rotateStringArray: true,
compact: true,
controlFlowFlattening: false,
deadCodeInjection: false,
debugProtection: false,
debugProtectionInterval: 0,
disableConsoleOutput: false,
identifierNamesGenerator: 'hexadecimal',
log: false,
numbersToExpressions: false,
renameGlobals: false,
selfDefending: false,
simplify: true,
splitStrings: false,
stringArray: true,
stringArrayCallsTransform: false,
stringArrayCallsTransformThreshold: 0.5,
stringArrayEncoding: [],
stringArrayIndexShift: true,
stringArrayRotate: true,
stringArrayShuffle: true,
stringArrayWrappersCount: 1,
stringArrayWrappersChainedCalls: true,
stringArrayWrappersParametersMaxCount: 2,
stringArrayWrappersType: 'variable',
stringArrayThreshold: 0.75,
unicodeEscapeSequence: false,
},
[
path.join(__dirname, 'node_modules'),
path.join(__dirname, 'resources/js/app.js'),
path.join(__dirname, 'resources/js/bootstrap.js'),
path.join(__dirname, 'resources/js/service-worker.js'),
]),
],
});
}
```

Before this I do all the mix.js() to the files that I need for dev and production.

I am missing something important for sure, but can't find what I am doing wrong to exclude those files.

Maybe some mix function as it could be done in the old version?

```
mix.serve('php artisan lang:js')
.obfuscator({
options: {
compact: true,
controlFlowFlattening: false,
deadCodeInjection: false,
debugProtection: false,
debugProtectionInterval: 0,
disableConsoleOutput: false,
identifierNamesGenerator: 'hexadecimal',
log: false,
numbersToExpressions: false,
renameGlobals: false,
selfDefending: false,
simplify: true,
splitStrings: false,
stringArray: true,
stringArrayCallsTransform: false,
stringArrayCallsTransformThreshold: 0.5,
stringArrayEncoding: [],
stringArrayIndexShift: true,
stringArrayRotate: true,
stringArrayShuffle: true,
stringArrayWrappersCount: 1,
stringArrayWrappersChainedCalls: true,
stringArrayWrappersParametersMaxCount: 2,
stringArrayWrappersType: 'variable',
stringArrayThreshold: 0.75,
unicodeEscapeSequence: false
},
exclude: [
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'resources/js/app.js'),
path.resolve(__dirname, 'resources/js/bootstrap.js'),
path.resolve(__dirname, 'resources/js/service-worker.js'),
]
});
}
```

Thank you for the help :)

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con la configuración de WebpackObfuscator y la clase webpackObfuscatorPlugin mencionadas en el issue; después, sigue el proceso mediante el que se comparan las rutas excluidas. Reproduce la compilación de producción de Laravel Mix que incluye resources/js/service-worker.js, app.js y bootstrap.js. Se considera terminado cuando los archivos indicados quedan excluidos y la compilación del service worker finaliza sin el error self.__manifest.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, typescript, webpack
Área
build-system, tooling
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
42/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.