Coder Social home page Coder Social logo

niemenjoki / compress-create-react-app Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 4.0 362 KB

An NPM package which allows easily adding post build compression to a create-react-app with minimal configuration

License: Other

JavaScript 99.46% Shell 0.54%
brotli compression create-react-app gzip

compress-create-react-app's Issues

'compress-cra' is not recognized

npm run build results in
'compress-cra' is not recognized as an internal or external command, operable program or batch file.

Getting error when setting retainUncompressedFiles to false

There seems to be a error after compressing files when retainUncompressedFiles is set to false. Without this option, the br compression runs as usual and the only difference is that it stores original webp files

[compress-create-react-app]:
Compressing build files...
    
node:fs:1538
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, stat '/home/hostname/02repos/weatherts/build/index.html'
    at Object.statSync (node:fs:1538:3)
    at /home/hostname/02repos/weatherts/node_modules/compress-create-react-app/src/getCombinedSize.js:6:21
    at Array.forEach (<anonymous>)
    at getCombinedSize (/home/hostname/02repos/weatherts/node_modules/compress-create-react-app/src/getCombinedSize.js:5:16)
    at printResult (/home/hostname/02repos/weatherts/node_modules/compress-create-react-app/src/printResult.js:6:28)
    at /home/hostname/02repos/weatherts/node_modules/compress-create-react-app/src/index.js:21:5 {
  errno: -2,
  syscall: 'stat',
  code: 'ENOENT',
  path: '/home/hostname/02repos/weatherts/build/index.html'
}

compress-cra.json:

{
  "algorithms": ["br"],
  "filetypes": [
    ".html",
    ".js",
    ".css",
    ".svg",
    ".png",
    ".jpg",
    ".webp",
    ".mp3",
    ".wav",
    ".tff",
    ".woff2",
    ".map"
  ],
  "directory": "/build",
  "retainUncompressedFiles": false
}

npm 8.19.2
node v16.14.2

thanks

Specify build folder as argument

I'm using a multi-package setup with lerna and yarn workspaces

As such, my build dir is actually packages/apps/projectname/build

It would be great if you could specify that as a CLI argument

I might take a go at it

Add to my framework

Good morning,
I hope this message finds you well. I found impressive your library and I hope to implement some functions in the create-new-startup bundler.

I was writing to formally seek your permission before I implemented a portion of your codebase. I'm only taking functions that interest me. Is there an attribution style you prefer? Thank you.

Does not compress all types of files

I wish we could have a compress-create-react-app.json file with configurations.

Then we could specify which files to compress, I would like to compress images, fonts, audio as well.

EOF running out of memory

How much memory does compress-cra need?

Can we limit it?

If this is a fork() do we need to increase NODE parameters for forking?

env: node\r: No such file or directory

Hi there!

We just upgraded to the latest version (1.4.1) and we are having an issue when using the compress-cra command when building the app on a Mac. It seems that we have the same issue on Linux.

env: node\r: No such file or directory

Issue is caused by carriage return on Windows vs. mac. Have you seen this issue before?

Bram

Use LF instead of CRLF

Just for Unix-like OS-es compatibility. Right now it doesn't work on Linux and might not work on macOS as well. It returns env: node\r: No such file or directory

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.