I have a React app that imports a library (in the node_modules directory, of course).
The name of the library is @lib/schema
.
In the react app, modules of this library are imported like so:
import { module_name } from "@lib/schema"
There is a certain file in the @lib/schema
that is currently being included in the final bundle, which is located in this path:
src/path/to/large_file.js
The file is never used by the app and thus unnecessarily increases the size of the bundle.
The React app currently uses react-scripts
to create the bundle.
Questions:
- If the React app were to continue to use
react-scripts
, how to configure it to excludesrc/path/to/large_file.js
? - If the React app were to use
webpack
, how to configure it to excludesrc/path/to/large_file.js
?