-
Notifications
You must be signed in to change notification settings - Fork 469
Added production ready settings for react theme #2587
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
Merged
chenglou
merged 2 commits into
rescript-lang:master
from
thangngoc89:thangngoc89-react-theme
Mar 8, 2018
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
# ${bsb:name} | ||
|
||
Run this project: | ||
## Run this project: | ||
|
||
``` | ||
npm install | ||
npm start | ||
# in another tab | ||
npm run webpack | ||
``` | ||
|
||
After you see the webpack compilation succeed (the `npm run webpack` step), open up the nested html files in `src/*` (**no server needed!**). Then modify whichever file in `src` and refresh the page to see the changes. | ||
|
||
**For more elaborate ReasonReact examples**, please see https://github.com/reasonml-community/reason-react-example | ||
|
||
## Build this project | ||
|
||
``` | ||
npm run build | ||
npm run webpack:build | ||
``` | ||
|
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using es6 by default is probably a bad idea, as it'll decrease compatibility with various tools. I think you've already had issues using es6 modules with
bs-jest
?commonjs
on the other hand is the lowest-common denominator. As far I understand, the primary benefit of using es6 is to be able to show off tiny hello world bundles, but I don't think that is justification enough for increasing friction for newcomers.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thangngoc89 what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@glennsl I've successfully config bs-jest for working with es6, this is my current config:
This is nothing crazy, I'm telling jest to transpile bs-jest, bs-platform, reason-react, bs-react-test-renderer and friends because jest doesn't transpile anything in node_modules by default. Perhaps you would accept a PR to
bs-jest
's README about this @glennsl ?Hmm, the main benefit is definitely not for the hello world, It's a good default for treeshaking and a small bundle in real world app. The ecosystem has adapted with ES6 modules and I would say it's sane to enable it right now.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A sidenote: You could set transformIgnorePatterns to
[ ""]
but that would introduced a lot of overhead.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we sure that es6 also works well with other tools than bs-jest?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me throw in my 2c. ES6 is the standard in frontend dev. If we want to be taken seriously as a replacement for Babel and friends, we need to show we care about bundle size.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely, but I don't think this is actually all the required configuration. Don't you need to add babel-jest too?
The few who require tiny bundle sizes can probably figure out how to enable es6 modules through some guide. I don't think it's a good idea to (possibly) sacrifice newcomer experience for the very minor convenience of having an advanced optimization enabled by default. At the very least I'd like to see this tested for a bit to have a better idea of its consequences before enabling it as the default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. We can test it in master and release it (or not) based on that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. I do. I think it's best that we change this back to commonjs. Also I want to see this happens #2418 . This won't require a custom config for jest
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, let's use commonjs and put a comment right above on using es6 (bsconfig.json parser accepts comments and trailing commas).
Edit: or maybe put it in webpack.config.js or README? @thangngoc89?