Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using with app created by Vue CLI fails to build #124

Open
artfc opened this issue Aug 23, 2021 · 6 comments
Open

Using with app created by Vue CLI fails to build #124

artfc opened this issue Aug 23, 2021 · 6 comments

Comments

@artfc
Copy link

artfc commented Aug 23, 2021

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)

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

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

These steps produce the following error:

  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), <anonymous>: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), <anonymous>: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), <anonymous>: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), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (C:\Users\user\Desktop\test\test\node_modules\tapable\lib\Hook.js:154:20)
@weiyan-zzh
Copy link

遇到相同的的问题请问解决了吗

@uncle-light
Copy link

遇到相同的的问题请问解决了吗

我也遇到了这个问题

@SmellyTrotter
Copy link

遇到相同的的问题请问解决了吗

我也遇到了这个问题

me too

@SmellyTrotter
Copy link

版本号使用:js-ob:2.5.0 webpack-ob:2.6.0(webpack@4)

@ben-Run
Copy link

ben-Run commented Dec 29, 2021

@SmellyTrotter 需要配置loader 吗?我的打包之后发布上去,跑不起来

@advissor
Copy link

Solved by installing the following version :

npm install --save-dev javascript-obfuscator@2.5.0 webpack-obfuscator@2.6.0

Solution for : Cannot read property 'tap' of undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants