Skip to content

Error: ENOENT: no such file or directory, scandir './css-obfuscator' #3

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

Closed
sccofield opened this issue Jan 10, 2024 · 10 comments
Closed
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed inactive

Comments

@sccofield
Copy link

Hey @soranoo, thank you so much for the beautiful work done so far.

At the moment, I used your settings as seen below. I can see that the tailwind classes have been obfuscated but i can't see the effect of the tailwind classes.

postcss.config.js

const isObfscMode = process.env.NODE_ENV === 'obfuscation';

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
    'next-css-obfuscator/patched-postcss-obfuscator': {
      enable: isObfscMode,
      extensions: ['.jsx', '.tsx', '.js', '.ts', '.html'],
      formatJson: true, // 👈 must be true
      keepData: true, // 👈 must be true
      whiteListedPaths: [],
      blackListedPaths: ['./next/cache'],
      excludeAnyMatchRegex: [
        /\.next\/server\/pages\/api/,
        /_document..*js/,
        /_app-.*/,
      ],
      classIgnore: ['static'],
      callBack: function () {
        // @ts-ignore
        process.env.NODE_ENV = 'production'; // to make sure postcss-obfuscator doesn't re-run.
      },
    },
  },
};
Screenshot 2024-01-10 at 5 32 44 AM
@soranoo
Copy link
Owner

soranoo commented Jan 10, 2024

Do you mean the page is broken after obfuscation?

@sccofield
Copy link
Author

yea @soranoo the page is broken, the tailwind styles don't reflect on the page.

I tried starting the process all over on another branch but i am now getting this error when i run the obfuscate-build command

Error: ENOENT: no such file or directory, scandir './css-obfuscator'

@soranoo
Copy link
Owner

soranoo commented Jan 11, 2024

Which OS are you using?

@sccofield
Copy link
Author

macbook

@soranoo
Copy link
Owner

soranoo commented Jan 11, 2024

I don't have any Apply device. I can't debug the issue but you may create the folder yourself and see what happens next.

root folder
|
|_  src
|_ css-obfuscator

@sccofield
Copy link
Author

After creating the folder css-obfuscator, and running npm run obfuscate-build, it tells me Obfuscation Obfuscation complete , but no file is created in the folder.

@soranoo
Copy link
Owner

soranoo commented Jan 12, 2024

I have totally no idea why this happened. It works perfectly in my Docker Linux.

@soranoo soranoo changed the title Issues with Nextjs 14 Failed to obfuscate in MacOS (Next 14) Jan 12, 2024
@soranoo soranoo added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers labels Jan 12, 2024
@soranoo soranoo pinned this issue Jan 12, 2024
@soranoo
Copy link
Owner

soranoo commented Jan 16, 2024

Finally, I got the error.

To address this,

  1. If there are 2 postcss.config remove the one end with .js.

image

@soranoo soranoo changed the title Failed to obfuscate in MacOS (Next 14) Error: ENOENT: no such file or directory, scandir './css-obfuscator' Jan 16, 2024
@soranoo
Copy link
Owner

soranoo commented Jan 21, 2024

v.2.0.0 has been released.

@soranoo soranoo unpinned this issue Jan 21, 2024
@soranoo
Copy link
Owner

soranoo commented Jan 31, 2024

The issue will be closed, please open a new one if encounter it again.

@soranoo soranoo closed this as completed Jan 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers help wanted Extra attention is needed inactive
Projects
None yet
Development

No branches or pull requests

2 participants