Skip to content
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

Should we have a Default Loader? #4

Closed
akrigline opened this issue Mar 12, 2018 · 2 comments
Closed

Should we have a Default Loader? #4

akrigline opened this issue Mar 12, 2018 · 2 comments
Labels
discussion webpack Issue has to do with webpack config.
Milestone

Comments

@akrigline
Copy link
Contributor

akrigline commented Mar 12, 2018

The create-react-app webpack config has configured their loaders to use rule.oneOf to see if a file matches one of the specific loaders configured, and if not, use the generic file-loader.

I'm not certain how useful this is though as webpack will still yell at you if you try to import something that it doesn't know how to handle more often than not.

Thoughts?

Create React App's config:
https://github.com/facebook/create-react-app/blob/next/packages/react-scripts/config/webpack.config.dev.js#L166

@akrigline akrigline added webpack Issue has to do with webpack config. discussion labels Mar 12, 2018
@akrigline
Copy link
Contributor Author

akrigline commented Mar 12, 2018

Doing some digging through CRA's history it looks like they came to the conclusion that a default file-loader was beneficial because of the scope they were trying to handle. Many people were trying to load many file types that were unorthodox. Edge cases were easier to solve all at once with a catchall loader than on a case-by-case basis (CRA is supposed to be zero-configuration).

For our purposes, I think us leaving webpack to error out if a project starts dealing with a different kind of file is sufficient.

At the same time, It's not like having a catchall file-loader rule will hurt anything. It's already a dependency.

@akrigline akrigline added this to the Make react-gantry project ready. milestone Mar 15, 2018
@akrigline
Copy link
Contributor Author

We're going to leave this as it is now. If this purposeful breaking strategy gets annoying, we'll revisit later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion webpack Issue has to do with webpack config.
Projects
None yet
Development

No branches or pull requests

1 participant