diff --git a/.gitignore b/.gitignore index faf19280..d11b3f9b 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,5 @@ jspm_packages # VScode workspace settings .vscode/ +static/dll.vendor.js +dll \ No newline at end of file diff --git a/common/index.html b/common/index.html index 5505bef7..a49b41c1 100644 --- a/common/index.html +++ b/common/index.html @@ -8,7 +8,7 @@ - + @@ -20,7 +20,7 @@ -
+
- + \ No newline at end of file diff --git a/common/vendors.js b/common/vendors.js new file mode 100644 index 00000000..8cf087e6 --- /dev/null +++ b/common/vendors.js @@ -0,0 +1,28 @@ +require('ethereumjs-abi'); +require('ethereumjs-util'); +require('ethereumjs-wallet'); +require('hdkey'); +require('idna-uts46'); +require('lodash'); +require('react'); +require('react-dom'); +require('react-markdown'); +require('react-redux'); +require('react-router'); +require('react-router-redux'); +require('redux'); +require('redux-form'); +require('redux-logger'); +require('redux-saga'); +require('wallet-address-validator'); +require('scryptsy'); +require('store2'); +require('uuid'); +require('whatwg-fetch'); +require('moment'); +require('prop-types'); +require('qrcode'); +require('qrcode.react'); +require('bignumber.js'); +require('classnames'); +require('./vendor/trezor-connect'); diff --git a/package.json b/package.json index ba848d8f..01c1551f 100644 --- a/package.json +++ b/package.json @@ -110,6 +110,7 @@ "predev": "check-node-version --package", "flow": "flow", "derivation-checker": "babel-node common/derivation-checker.js --presets es2015,stage-0,flow", + "postinstall": "webpack --config=./webpack_config/webpack.dll.js", "start": "npm run dev", "precommit": "lint-staged" }, diff --git a/webpack_config/webpack.base.js b/webpack_config/webpack.base.js index 8fb51bd7..7df90253 100644 --- a/webpack_config/webpack.base.js +++ b/webpack_config/webpack.base.js @@ -7,6 +7,7 @@ const config = require('./config'); const _ = require('./utils'); module.exports = { + cache: true, entry: { client: './common/index.jsx' }, @@ -31,7 +32,12 @@ module.exports = { loaders: [ { test: /\.(js|jsx)$/, - loaders: ['babel-loader'], + loaders: [ + { + loader: 'babel-loader', + query: { cacheDirectory: true } + } + ], exclude: [/node_modules\/(?!ethereum-blockies|idna-uts46)/] }, { diff --git a/webpack_config/webpack.dev.js b/webpack_config/webpack.dev.js index 43c8a659..4bf406fa 100644 --- a/webpack_config/webpack.dev.js +++ b/webpack_config/webpack.dev.js @@ -1,6 +1,6 @@ 'use strict'; process.env.NODE_ENV = 'development'; - +const path = require('path'); const webpack = require('webpack'); const base = require('./webpack.base'); const FriendlyErrors = require('friendly-errors-webpack-plugin'); @@ -25,6 +25,10 @@ base.module.loaders.push( ); base.plugins.push( + new webpack.DllReferencePlugin({ + context: path.join(__dirname, '../common'), + manifest: require('../dll/vendor-manifest.json') + }), new webpack.DefinePlugin({ 'process.env.NODE_ENV': JSON.stringify('development') }), diff --git a/webpack_config/webpack.dll.js b/webpack_config/webpack.dll.js new file mode 100644 index 00000000..bb39a778 --- /dev/null +++ b/webpack_config/webpack.dll.js @@ -0,0 +1,31 @@ +const path = require('path'); +const webpack = require('webpack'); +const config = require('./config'); +const _ = require('./utils'); + +module.exports = { + entry: { + vendor: [path.join(__dirname, '../common', 'vendors.js')] + }, + output: { + path: path.join(__dirname, '../static'), + filename: 'dll.[name].js', + library: '[name]' + }, + plugins: [ + new webpack.DllPlugin({ + path: path.join(__dirname, '../dll', '[name]-manifest.json'), + name: '[name]', + context: path.resolve(__dirname, '../common') + }) + ], + resolve: { + modules: [ + // places where to search for required modules + 'node_modules', + config.srcPath, + _.cwd('node_modules'), + _.cwd('./') + ] + } +};