javascript-obfuscator / javascript-obfuscator/webpack-obfuscator

Using with app created by Vue CLI fails to build

Open
#124 6 comments 5 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
928
Forks
92
PR merge metrics
No merged PRs in 30d

Description

When I try to use webpack-obfuscator with a project created by Vue CLI, it throws an exception ```TypeError: Cannot read property 'tap' of undefined```.

Steps to reproduce:
1) Create an app using Vue CLI as described at https://cli.vuejs.org/
```
vue create my-project
# OR
vue ui
```
(select vue3+babel preset)

2) Install webpack-obfuscator ```npm i --save-dev webpack-obfuscator javascript-obfuscator```
3) Add vue.config.js to the project root
```
//vue.config.js
const WebpackObfuscator = require('webpack-obfuscator');

module.exports = {
configureWebpack: {
plugins: [
new WebpackObfuscator({
rotateStringArray: true
})
]
}
}
```
4) Try to build the project ``` vue-cli-service build```

These steps produce the following error:
```PS C:\Users\user\Desktop\test\test> vue-cli-service build

✔ Building for production...
ERROR TypeError: Cannot read property 'tap' of undefined
TypeError: Cannot read property 'tap' of undefined
at C:\Users\user\Desktop\test\test\node_modules\webpack-obfuscator\dist\plugin\index.js:25:45
at SyncHook.eval (eval at create (C:\Users\user\Desktop\test\test\node_modules\tapable\lib\HookCodeFactory.js:19:10), :23:1)
at SyncHook.lazyCompileHook (C:\Users\user\Desktop\test\test\node_modules\tapable\lib\Hook.js:154:20)
at Compiler.newCompilation (C:\Users\user\Desktop\test\test\node_modules\webpack\lib\Compiler.js:631:26)
at C:\Users\user\Desktop\test\test\node_modules\webpack\lib\Compiler.js:667:29
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\user\Desktop\test\test\node_modules\tapable\lib\HookCodeFactory.js:33:10), :6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\user\Desktop\test\test\node_modules\tapable\lib\Hook.js:154:20)
at Compiler.compile (C:\Users\user\Desktop\test\test\node_modules\webpack\lib\Compiler.js:662:28)
at C:\Users\user\Desktop\test\test\node_modules\webpack\lib\Compiler.js:321:11
at Compiler.readRecords (C:\Users\user\Desktop\test\test\node_modules\webpack\lib\Compiler.js:529:11)
at C:\Users\user\Desktop\test\test\node_modules\webpack\lib\Compiler.js:318:10
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\user\Desktop\test\test\node_modules\tapable\lib\HookCodeFactory.js:33:10), :6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\user\Desktop\test\test\node_modules\tapable\lib\Hook.js:154:20)
at C:\Users\user\Desktop\test\test\node_modules\webpack\lib\Compiler.js:315:19
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\user\Desktop\test\test\node_modules\tapable\lib\HookCodeFactory.js:33:10), :15:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\user\Desktop\test\test\node_modules\tapable\lib\Hook.js:154:20)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with the Vue CLI steps and configuration shown in the issue, then inspect dist/plugin/index.js at line 25 where the tap error occurs. Run vue-cli-service build against the sample Vue 3 project; done means the build completes without the reported TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.