Skip to content

Example for using with create-react-app #7

@Rud156

Description

@Rud156

BUG: The class names generated start with numbers and class names starting with numbers are not accepted

This is not exactly a BUG but an addition to the docs on how to use it with create-react-app will be amazingly helpful. Although it needs ejecting it would be great.

I had to pull out:

root.walkRules(rule => {
    if (!rule.selectors) {
        return rule;
    }
    rule.selectors = rule.selectors.map(
        obfuscateClassNames.obfuscateClassNamesInSelector({
            seed: "app"
        })
    );
});

An write my own postcss -loader plugin to get the obfuscation to work. But when building I get the error Failed to minify the code from this file: ./node_modules/react-armor/dist/node/prod/lib/transformClassNames.js:17

After fixing the import like import obfuscateClassNames from "react-armor/dist/node/prod/lib/obfuscateClassNames"; I now get an error saying Failed to minify the code from this file: ./node_modules/react-traverse/dist/node/prod/lib/traverse.js:43.

Managed to get it working. But its not great about how I did it. I think integration should be easier

Also can you consider recompile and public your package as ES5 to npm

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions