-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Fix sourcemaps by refactoring the build system #11843
Merged
Merged
Conversation
This file contains 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
Remove now-retired package.json property
This moves the babel and postcss configs into the webpack config for ease of maintenance (and because we need variations of them). The typescript config is left outside the webpack config for IDEs to pick it up.
We compile directly for accuracy of sourcemaps.
Convert components to ES6 exports
Import from src/ for the react-sdk and js-sdk
For reasons described within this diff.
We have to convert *something* to TypeScript so it doesn't complain that there's nothing to compile, so this converts the easiest utility library. Many of the scripts are copied from the react-sdk.
Make the webpack config work for us
Update build scripts for new process
Sourcemaps: develop -> feature branch
This was referenced Jan 13, 2020
We previously ignored this whole directory, and it's a bit of wishful thinking that we'll have these delinted as a result. Switching to Jest should fix most of the problems anyways, so we can enable the linter when we get there.
There's a bunch of generated files that webpack relies on to work, and Karma works off webpack. To make both happy we've added a new `build:genfiles` script which takes care of this for us. We also have to install and build our other layers to get the same effect (like generating the react-sdk's component index, while we still have one). This commit also fixes all the imports in the tests because they were just wrong. They should have been caught in the ES6ification earlier, but were missed.
turt2live
force-pushed
the
travis/sourcemaps
branch
from
January 14, 2020 03:40
89f020a
to
a978a67
Compare
dbkr
reviewed
Jan 14, 2020
dbkr
approved these changes
Jan 15, 2020
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.
Fixes #8880
Requires matrix-org/matrix-react-sdk#3839
Requires matrix-org/matrix-js-sdk#1151
All the commits before 3b688aa have been reviewed already. This PR just needs the checkmark for 3b688aa and beyond.
Developer info: Migration guide
New developers to the project can just follow the existing instructions in the README - these are unchanged. Existing developers may find themselves unable to compile Riot after this PR and its associates land.
Existing developers: Cancel your existing webpack dev server if it is running then pull the latest develop. In each layer,
yarn install
thenyarn build
to regenerate some of the project's files (component index, etc). There are faster ways, but this is the easiest to write down. After all 3 layers have been installed and built, feel free to runyarn start
in riot-web again and notice that the app looks exactly the same. Your development process is the same as it was before: start the day withyarn start
and hack away.Oh, also your sourcemaps should be working now.
New development practices
The build system is shiny and new, but overall not terribly exciting. Along the way some decisions have been made about our development practices that you may or may not notice:
MatrixClientPeg
is no longer a default export. Import it withimport {MatrixClientPeg} from "./MatrixClientPeg";
import * as sdk from "./index";
instead ofimport sdk from "./index";
import {Room} from "matrix-js-sdk/src/models/room";
require()
in the imports like the plague.export default
and remember to add things to theindex.ts
file.export default
components but avoidexport default
for utilities and not-components.module.exports
unless you have to (like in the end-to-end tests which are run by Node directly).#riot-dev is the best place to question any of these decisions, though many of them are just riot-web being thrust forward by 3-4 years in terms of ecosystem support.