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

webpack-obfuscator not working on Firebase deployment #155

Open
bangank36 opened this issue Feb 24, 2023 · 1 comment
Open

webpack-obfuscator not working on Firebase deployment #155

bangank36 opened this issue Feb 24, 2023 · 1 comment

Comments

@bangank36
Copy link

Expected Behavior

webpack-obfuscator and javacript-obfuscator should be working on Firebase deployment without issue

Current Behavior

My firebase functions are deployed correctly unless I import webpack-obfuscator or javacript-obfuscator
Always produce error

Did you list all required modules in the package.json dependencies?
Detailed stack trace: Error: Cannot find module 'webpack-obfuscator'
webpack-obfuscator javacript-obfuscator
sample code image image
error image image

Steps to Reproduce

  • Install webpack-obfuscator
  • Run firebase emulators:start to test the function, it working properly
  • Run firebase deploy the functions can not be deployed

Enviroment

  • Node 14
  • "webpack-obfuscator": "3.5.1",
  • "javascript-obfuscator": "4.0.2"

Reference

I have taken a look at these issues, but either they are outdated or not work

cc: @sanex3339 since you found a bug in loader ( but it was 3 years ago )

@bangank36
Copy link
Author

Updates Feb, 26 2023

  • While I can not figure out the root cause of this issue. I have come up with a work around by import the webpack-obfuscator on runtime, doing that making the Firebase deployment works seamlessly

Before

const StringReplacePlugin = require("string-replace-webpack-plugin");
const TerserPlugin = require('terser-webpack-plugin');
const WebpackObfuscator = require('webpack-obfuscator');

module.exports = function(inputFile, siteId, WebpackObfuscator) { ... }

After

const StringReplacePlugin = require("string-replace-webpack-plugin");
const TerserPlugin = require('terser-webpack-plugin');

module.exports = function(inputFile, siteId, WebpackObfuscator) { 
    const WebpackObfuscator = require('webpack-obfuscator');
    ....
}

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

1 participant