ghostdevv / rollup-obfuscator

A plugin to obfuscate javascript for rollup based on https://www.npmjs.com/javascript-obfuscator
MIT License
55 stars 7 forks source link

How to solve this error? #107

Closed CRC32EX closed 2 years ago

CRC32EX commented 2 years ago

Steps to reproduce this issue

  1. Init Vue3 project

    npm init vue@latest

    image

  2. Install modules

    cd vue-project
    npm install
    npm install -D rollup-obfuscator javascript-obfuscator
  3. Edit vite.config.ts

    vim vite.config.ts

    image

  4. Build

    npm run build
  5. Error

    vite v2.8.6 building for production...
    ✓ 0 modules transformed.
    [obfuscator] Unexpected token (1:0)
    file: C:/Users/user01/Desktop/vue-project/index.html
    error during build:
    Error: Unexpected token (1:0)
    at Function.processParsingError (C:\Users\user01\Desktop\vue-project\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\ASTParserFacade.ts:62:19)
    at Function.parse (C:\Users\user01\Desktop\vue-project\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\ASTParserFacade.ts:39:49)
    at o.parseCode (C:\Users\user01\Desktop\vue-project\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\JavaScriptObfuscator.ts:82:50)
    at obfuscate (C:\Users\user01\Desktop\vue-project\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\JavaScriptObfuscator.ts:73:30)
    at obfuscate (C:\Users\user01\Desktop\vue-project\node_modules\javascript-obfuscator\dist\webpack:\javascript-obfuscator\src\JavaScriptObfuscatorFacade.ts:16:56)
    at Object.transform (C:\Users\user01\Desktop\vue-project\node_modules\rollup-obfuscator\dist\index.js:43:69)
    at C:\Users\user01\Desktop\vue-project\node_modules\rollup\dist\shared\rollup.js:22779:37
ghostdevv commented 2 years ago

Hey, I published version 2.1.0, can you upgrade to this version and see if it fixes your problem? @CRC32EX

CRC32EX commented 2 years ago

Thank you so much. Works successfully.