feat: allow to ignore modules from processing #287
Merged
Conversation
f404938 to
882a588
Compare
thymikee
approved these changes
Jan 5, 2019
|
|
||
| * `evaluate: boolean` (default: `true`) - Enabling this will evaluate dynamic expressions in the CSS. You need to enable this if you want to use imported variables in the CSS or interpolate other components. Enabling this also ensures that your styled components wrapping other styled components will have the correct specificity and override styles properly. | ||
| * `displayName: boolean` (default: `false`) - Enabling this will add a display name to generated class names, e.g. `.Title_abcdef` instead of `.abcdef'. It is disabled by default to generate smaller CSS files. | ||
| * `exclude: RegExp` (default: `/node_modules/`) - If you specify a regex here, files matching the regex won't be processed, i.e. the matching files won't be transformed with Babel during evaluation. If you need to transpile certain modules under `/node_modules/`, it's recommended to do it on a module by module basis for faster transforms, e.g. `exclude: /node_modules(?!.*[\/\\](some-module))/`. |
Member
There was a problem hiding this comment.
I find this regex to be simpler: node_modules[\/\\](?!some-module|other-module).
Btw, how about using globs? They're generally less confusing than regular expressions and Babel supports them (to some extent at least)
EDIT: pardon, I forgot we don't use Babel resolution here, so we'd have to import glob library, which are painful to work with (different glob syntaxes with different versions and Windows issues)
thymikee
reviewed
Jan 5, 2019
882a588 to
23ff918
Compare
Member
Author
|
@thymikee updated the PR. had to rename |
Member
|
👍 |
23ff918 to
d38a444
Compare
steffenmllr
reviewed
Jan 5, 2019
| options = { | ||
| displayName: false, | ||
| evaluate: true, | ||
| exclude: /node_modules/, |
Transpiling a large number of files can cause significant slowdowns, especially visible when transforming files under `/node_modules/`. This ignores `/node_modules/` by default and adds a config option to customize which files to ignore. As a next step, we should also cache the files we transpile in-memory to optimize it further. Fixes #286
d38a444 to
f1ac80a
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Transpiling a large number of files can cause significant slowdowns, especially visible when transforming files under
/node_modules/.This excludes
/node_modules/by default and adds a config option to customize which files to exclude.As a next step, we should also cache the files we transpile in-memory to optimize it further.
Fixes #286