diff --git a/.circleci/config.yml b/.circleci/config.yml index e2f5431ee1..82aefbe54b 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -232,14 +232,14 @@ jobs: environment: - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org" - COMMIT_AUTHOR: "Circle CI" - - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/runtime.js dist/apps/remix-ide/vendor.js dist/apps/remix-ide/favicon.ico" + - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/favicon.ico" working_directory: ~/remix-project steps: - checkout - run: npm install - run: npm run downloadsolc_assets - - run: npx nx build remix-ide --with-deps + - run: npm run build:production - run: name: Deploy command: | @@ -260,7 +260,7 @@ jobs: environment: - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org" - COMMIT_AUTHOR: "Circle CI" - - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/runtime.js dist/apps/remix-ide/vendor.js dist/apps/remix-ide/favicon.ico" + - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/favicon.ico" working_directory: ~/remix-project steps: @@ -268,7 +268,7 @@ jobs: - setup_remote_docker - run: npm install - run: npm run downloadsolc_assets - - run: npx nx build remix-ide --with-deps + - run: npm run build:production - run: ./apps/remix-ide/ci/copy_resources.sh - run: ./apps/remix-ide/ci/publishIpfs - run: ./apps/remix-ide/ci/build_and_publish_docker_images.sh @@ -286,14 +286,14 @@ jobs: environment: - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org" - COMMIT_AUTHOR: "Circle CI" - - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/runtime.js dist/apps/remix-ide/vendor.js dist/apps/remix-ide/favicon.ico" + - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/favicon.ico" working_directory: ~/remix-project steps: - checkout - run: npm install - run: npm run downloadsolc_assets - - run: npx nx build remix-ide --with-deps + - run: npm run build:production - run: name: Deploy command: | @@ -314,7 +314,7 @@ jobs: environment: - COMMIT_AUTHOR_EMAIL: "yann@ethereum.org" - COMMIT_AUTHOR: "Circle CI" - - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/runtime.js dist/apps/remix-ide/vendor.js dist/apps/remix-ide/favicon.ico" + - FILES_TO_PACKAGE: "dist/apps/remix-ide/assets dist/apps/remix-ide/index.html dist/apps/remix-ide/main.js dist/apps/remix-ide/polyfills.js dist/apps/remix-ide/favicon.ico" working_directory: ~/remix-project steps: @@ -322,7 +322,7 @@ jobs: - run: npm install - run: npm run build:libs - run: npm run downloadsolc_assets - - run: npm run build + - run: npm run build:production - run: name: Deploy command: | diff --git a/README.md b/README.md index 8c06826bd9..569e3be0a1 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,18 @@ Run `nx serve` and open `http://127.0.0.1:8080` in your browser. Then open your `text editor` and start developing. The browser will automatically refresh when files are saved. +## Production Build +To generate react production builds for remix-project. +```bash +npm run build:production +``` +build can be found in `remix-project/dist/apps/remix-ide` directory. + +```bash +npm run serve:production +``` +production build will be served by default to `http://localhost:8080/` or `http://127.0.0.1:8080/` + ## Docker: Prerequisites: diff --git a/apps/debugger/webpack.config.js b/apps/debugger/webpack.config.js index bacc6e251e..02143af15b 100644 --- a/apps/debugger/webpack.config.js +++ b/apps/debugger/webpack.config.js @@ -1,17 +1,31 @@ const nxWebpack = require('@nrwl/react/plugins/webpack') +const TerserPlugin = require('terser-webpack-plugin') module.exports = config => { - const nxWebpackConfig = nxWebpack(config) + const nxWebpackConfig = nxWebpack(config) + const webpackConfig = { + ...nxWebpackConfig, + node: { + fs: 'empty', + tls: 'empty', + readline: 'empty', + net: 'empty', + module: 'empty', + child_process: 'empty' + } + } + if (process.env.NODE_ENV === 'production') { return { - ...nxWebpackConfig, - node: { - fs: 'empty', - tls: 'empty', - readline: 'empty', - net: 'empty', - module: 'empty', - child_process: 'empty' - } + ...webpackConfig, + mode: 'production', + devtool: 'source-map', + optimization: { + minimize: true, + minimizer: [new TerserPlugin()] + } } + } else { + return webpackConfig + } } diff --git a/apps/remix-ide/ci/deploy_from_travis_remix-alpha.sh b/apps/remix-ide/ci/deploy_from_travis_remix-alpha.sh index cdfd301afc..7f94dd65a5 100755 --- a/apps/remix-ide/ci/deploy_from_travis_remix-alpha.sh +++ b/apps/remix-ide/ci/deploy_from_travis_remix-alpha.sh @@ -14,7 +14,7 @@ echo "To use an offline copy, download \`remix-$SHA.zip\`." >> README.md cp -r $FILES_TO_PACKAGE "./" rm -rf dist ls -FILES_TO_DEPLOY="assets index.html main.js polyfills.js runtime.js vendor.js favicon.ico" +FILES_TO_DEPLOY="assets index.html main.js polyfills.js favicon.ico" # ZIP the whole directory zip -r remix-$SHA.zip $FILES_TO_DEPLOY # -f is needed because "build" is part of .gitignore diff --git a/apps/remix-ide/ci/deploy_from_travis_remix-beta.sh b/apps/remix-ide/ci/deploy_from_travis_remix-beta.sh index 764066c346..750a340373 100755 --- a/apps/remix-ide/ci/deploy_from_travis_remix-beta.sh +++ b/apps/remix-ide/ci/deploy_from_travis_remix-beta.sh @@ -14,7 +14,7 @@ echo "To use an offline copy, download \`remix-$SHA.zip\`." >> README.md cp -r $FILES_TO_PACKAGE "./" rm -rf dist ls -FILES_TO_DEPLOY="assets index.html main.js polyfills.js runtime.js vendor.js favicon.ico" +FILES_TO_DEPLOY="assets index.html main.js polyfills.js favicon.ico" # ZIP the whole directory zip -r remix-$SHA.zip $FILES_TO_DEPLOY # -f is needed because "build" is part of .gitignore diff --git a/apps/remix-ide/ci/deploy_from_travis_remix-live.sh b/apps/remix-ide/ci/deploy_from_travis_remix-live.sh index 88973a9ab1..ae6da39a5c 100755 --- a/apps/remix-ide/ci/deploy_from_travis_remix-live.sh +++ b/apps/remix-ide/ci/deploy_from_travis_remix-live.sh @@ -13,7 +13,7 @@ echo "Built website from \`$SHA\`. See https://github.com/ethereum/remix-ide/ fo echo "To use an offline copy, download \`remix-$SHA.zip\`." >> README.md cp -r $FILES_TO_PACKAGE "./" rm -rf dist -FILES_TO_DEPLOY="assets index.html main.js polyfills.js runtime.js vendor.js" +FILES_TO_DEPLOY="assets index.html main.js polyfills.js" # ZIP the whole directory zip -r remix-$SHA.zip $FILES_TO_DEPLOY # -f is needed because "build" is part of .gitignore diff --git a/apps/remix-ide/src/index.html b/apps/remix-ide/src/index.html index 502fa2aef6..ebc8a47c71 100644 --- a/apps/remix-ide/src/index.html +++ b/apps/remix-ide/src/index.html @@ -5,19 +5,15 @@