create-react-app icon indicating copy to clipboard operation
create-react-app copied to clipboard

How to exclude files while running "npm run build" script

Open seesamjagan opened this issue 9 years ago • 1 comments

Is this a bug report?

No

Question:

Is there a way that i could specify some files and folders to exclude while running the 'npm run build' script?

Reason:

so that my final minified main.js file does not have reference to those files which makes its size bit smaller by avoiding unnecessary codes.

What I tried:

i have tried to specify the files in .npmignore to exclude them while bundling. but still i see references in the final main.js file

seesamjagan avatar Sep 01 '17 01:09 seesamjagan

Webpack only includes files that have been imported somewhere in the dependency graph. If you haven't imported those unnecessary files, they won't be in your main.js.

tharakawj avatar Sep 02 '17 03:09 tharakawj