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

Set a require alias for the webapp directory #9014

Merged
merged 2 commits into from
Mar 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ else
fi

npm run clean
# riot-web is at `workspace`.
# matrix-react-sdk is at `workspace/node_modules/matrix-react-sdk`, but this is
# symlinked to a repo at `workspace/matrix-react-sdk`.
# To get from `workspace/matrix-react-sdk/lib` up to the lang file, we use:
RIOT_LANGUAGES_FILE="../../webapp/i18n/languages.json" npm run build$dev
npm run build$dev

# include the sample config in the tarball. Arguably this should be done by
# `npm run build`, but it's just too painful.
Expand Down
9 changes: 2 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
let og_image_url = process.env.RIOT_OG_IMAGE_URL;
if (!og_image_url) og_image_url = 'https://riot.im/app/themes/riot/img/logos/riot-im-logo-black-text.png';

// relative to languageHandler.js in matrix-react-sdk
let RIOT_LANGUAGES_FILE = process.env.RIOT_LANGUAGES_FILE;
if (!RIOT_LANGUAGES_FILE) {
RIOT_LANGUAGES_FILE = "../../riot-web/webapp/i18n/languages.json";
}

module.exports = {
entry: {
// Load babel-polyfill first to avoid issues where some imports (namely react)
Expand Down Expand Up @@ -157,14 +151,15 @@ module.exports = {

// same goes for js-sdk
"matrix-js-sdk": path.resolve('./node_modules/matrix-js-sdk'),

"$webapp": path.resolve('./webapp'),
},
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify(process.env.NODE_ENV),
},
'LANGUAGES_FILE': JSON.stringify(RIOT_LANGUAGES_FILE),
}),
new ExtractTextPlugin("bundles/[hash]/[name].css", {
allChunks: true,
Expand Down