diff --git a/apps/compile-details/project.json b/apps/compile-details/project.json new file mode 100644 index 0000000000..7d512b6137 --- /dev/null +++ b/apps/compile-details/project.json @@ -0,0 +1,61 @@ +{ + "name": "compile-details", + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "apps/compile-details/src", + "projectType": "application", + "implicitDependencies": [ + ], + "targets": { + "build": { + "executor": "@nrwl/webpack:webpack", + "outputs": ["{options.outputPath}"], + "defaultConfiguration": "development", + "options": { + "compiler": "babel", + "outputPath": "dist/apps/compile-details", + "index": "apps/compile-details/src/index.html", + "baseHref": "./", + "main": "apps/compile-details/src/main.tsx", + "tsConfig": "apps/compile-details/tsconfig.app.json", + "assets": [ + "apps/compile-details/src/favicon.ico", + "apps/compile-details/src/profile.json" + ], + "styles": [], + "scripts": [], + "webpackConfig": "apps/compile-details/webpack.config.js" + }, + "configurations": { + "development": { + }, + "production": { + "fileReplacements": [ + { + "replace": "apps/compile-details/src/environments/environment.ts", + "with": "apps/compile-details/src/environments/environment.prod.ts" + } + ] + } + } + }, + "serve": { + "executor": "@nrwl/webpack:dev-server", + "defaultConfiguration": "development", + "options": { + "buildTarget": "compile-details:build", + "hmr": true, + "baseHref": "/" + }, + "configurations": { + "development": { + "buildTarget": "compile-details:build:development", + "port": 6003 + }, + "production": { + "buildTarget": "compile-details:build:production" + } + } + } + }, + "tags": [] +} diff --git a/apps/compile-details/src/index.html b/apps/compile-details/src/index.html new file mode 100644 index 0000000000..6f9d486efb --- /dev/null +++ b/apps/compile-details/src/index.html @@ -0,0 +1,13 @@ + + + + + Compilation Details + + + + + +
+ + diff --git a/apps/compile-details/tsconfig.app.json b/apps/compile-details/tsconfig.app.json new file mode 100644 index 0000000000..af84f21cfc --- /dev/null +++ b/apps/compile-details/tsconfig.app.json @@ -0,0 +1,23 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "outDir": "../../dist/out-tsc", + "types": ["node"] + }, + "files": [ + "../../node_modules/@nrwl/react/typings/cssmodule.d.ts", + "../../node_modules/@nrwl/react/typings/image.d.ts" + ], + "exclude": [ + "jest.config.ts", + "**/*.spec.ts", + "**/*.test.ts", + "**/*.spec.tsx", + "**/*.test.tsx", + "**/*.spec.js", + "**/*.test.js", + "**/*.spec.jsx", + "**/*.test.jsx" + ], + "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] +} diff --git a/apps/compile-details/tsconfig.json b/apps/compile-details/tsconfig.json new file mode 100644 index 0000000000..5aab5e7911 --- /dev/null +++ b/apps/compile-details/tsconfig.json @@ -0,0 +1,16 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "jsx": "react-jsx", + "allowJs": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true + }, + "files": [], + "include": [], + "references": [ + { + "path": "./tsconfig.app.json" + } + ] +} diff --git a/apps/compile-details/webpack.config.js b/apps/compile-details/webpack.config.js new file mode 100644 index 0000000000..86bcf51395 --- /dev/null +++ b/apps/compile-details/webpack.config.js @@ -0,0 +1,70 @@ +const { composePlugins, withNx } = require('@nrwl/webpack') +const { withReact } = require('@nrwl/react') +const webpack = require('webpack') +const TerserPlugin = require('terser-webpack-plugin') +const CssMinimizerPlugin = require('css-minimizer-webpack-plugin') + +// Nx plugins for webpack. +module.exports = composePlugins(withNx(), withReact(), config => { + // Update the webpack config as needed here. + // e.g. `config.plugins.push(new MyPlugin())` + + // add fallback for node modules + config.resolve.fallback = { + ...config.resolve.fallback, + path: require.resolve('path-browserify'), + fs: false, + } + + // add externals + config.externals = { + ...config.externals, + solc: 'solc', + } + + config.module.rules.push({ + test: /\.hbs$/, + type: 'asset/source', + }) + + // add public path + config.output.publicPath = '/' + + // add copy & provide plugin + config.plugins.push( + new webpack.ProvidePlugin({ + Buffer: ['buffer', 'Buffer'], + url: ['url', 'URL'], + process: 'process/browser', + }), + new webpack.DefinePlugin({}), + ) + + // souce-map loader + config.module.rules.push({ + test: /\.js$/, + use: ['source-map-loader'], + enforce: 'pre', + }) + + config.ignoreWarnings = [/Failed to parse source map/] // ignore source-map-loader warnings + + // set minimizer + config.optimization.minimizer = [ + new TerserPlugin({ + parallel: true, + terserOptions: { + ecma: 2015, + compress: false, + mangle: false, + format: { + comments: false, + }, + }, + extractComments: false, + }), + new CssMinimizerPlugin(), + ] + + return config +})