commit
3c8c78fa4f
|
@ -78,7 +78,7 @@ const TransactionDataTable: React.SFC<Props> = ({ data, receipt, network }) => {
|
|||
{statusSeeMore &&
|
||||
explorer.tx &&
|
||||
!network.isCustom && (
|
||||
<NewTabLink className="TxData-row-data-more" href={explorer.tx}>
|
||||
<NewTabLink className="TxData-row-data-more" href={explorer.tx as string}>
|
||||
(See more on {network.blockExplorer.name})
|
||||
</NewTabLink>
|
||||
)}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
&-item {
|
||||
position: relative;
|
||||
padding-right: 10px;
|
||||
border-left: 2px solid #fff;
|
||||
border-left: 2px solid;
|
||||
|
||||
&-remove {
|
||||
position: absolute;
|
||||
|
|
|
@ -8,7 +8,7 @@ interface Props {
|
|||
}
|
||||
|
||||
const HelpLink: React.SFC<AAttributes & Props> = ({ article, children, ...rest }) => (
|
||||
<NewTabLink {...rest} href={`${knowledgeBaseURL}/${article}`}>
|
||||
<NewTabLink {...rest} href={`${knowledgeBaseURL}/${article}`} onClick={this.handleClick}>
|
||||
{children}
|
||||
</NewTabLink>
|
||||
);
|
||||
|
|
|
@ -61,7 +61,7 @@ export default class DropdownComponent<T> extends PureComponent<Props<T>, State>
|
|||
});
|
||||
const searchableStyle = {
|
||||
maxHeight: '300px',
|
||||
overflowY: 'auto' as 'auto'
|
||||
overflowY: 'auto'
|
||||
};
|
||||
const searchRegex = new RegExp(search, 'gi');
|
||||
const onSearchChange = (e: React.FormEvent<HTMLInputElement>) => {
|
||||
|
@ -69,7 +69,7 @@ export default class DropdownComponent<T> extends PureComponent<Props<T>, State>
|
|||
};
|
||||
|
||||
return (
|
||||
<ul className={menuClass} style={searchable ? searchableStyle : undefined}>
|
||||
<ul className={menuClass} style={searchable ? searchableStyle : {}}>
|
||||
{searchable && (
|
||||
<input
|
||||
className="form-control"
|
||||
|
|
|
@ -4,7 +4,12 @@ import {
|
|||
CustomNetworkAction,
|
||||
TypeKeys
|
||||
} from 'actions/config';
|
||||
import { CustomNetworksState as State } from './types';
|
||||
import { CustomNetworkConfig } from 'types/network';
|
||||
|
||||
// TODO: this doesn't accurately represent state, as
|
||||
export interface State {
|
||||
[customNetworkId: string]: CustomNetworkConfig;
|
||||
}
|
||||
|
||||
const addCustomNetwork = (state: State, { payload }: AddCustomNetworkAction): State => ({
|
||||
...state,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { customNetworks, State as CustomNetworksState } from './customNetworks';
|
||||
import { staticNetworks, State as StaticNetworksState } from './staticNetworks';
|
||||
import { combineReducers } from 'redux';
|
||||
import { customNetworks } from './customNetworks';
|
||||
import { staticNetworks } from './staticNetworks';
|
||||
import { StaticNetworksState, CustomNetworksState } from './types';
|
||||
|
||||
interface State {
|
||||
customNetworks: CustomNetworksState;
|
||||
|
|
|
@ -16,8 +16,9 @@ import {
|
|||
UBQ_DEFAULT
|
||||
} from 'config/dpaths';
|
||||
import { ConfigAction } from 'actions/config';
|
||||
import { BlockExplorerConfig } from 'types/network';
|
||||
import { StaticNetworksState as State } from './types';
|
||||
import { StaticNetworkIds, StaticNetworkConfig, BlockExplorerConfig } from 'types/network';
|
||||
|
||||
export type State = { [key in StaticNetworkIds]: StaticNetworkConfig };
|
||||
|
||||
// Must be a website that follows the ethplorer convention of /tx/[hash] and
|
||||
// address/[address] to generate the correct functions.
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
// Moving state types into their own file resolves an annoying webpack bug
|
||||
// https://github.com/angular/angular-cli/issues/2034
|
||||
import { StaticNetworkIds, StaticNetworkConfig, CustomNetworkConfig } from 'types/network';
|
||||
|
||||
export type StaticNetworksState = { [key in StaticNetworkIds]: StaticNetworkConfig };
|
||||
|
||||
// TODO: this doesn't accurately represent custom networks state
|
||||
export interface CustomNetworksState {
|
||||
[customNetworkId: string]: CustomNetworkConfig;
|
||||
}
|
|
@ -4,7 +4,11 @@ import {
|
|||
AddCustomNodeAction,
|
||||
RemoveCustomNodeAction
|
||||
} from 'actions/config';
|
||||
import { CustomNodesState as State } from './types';
|
||||
import { CustomNodeConfig } from 'types/node';
|
||||
|
||||
export interface State {
|
||||
[customNodeId: string]: CustomNodeConfig;
|
||||
}
|
||||
|
||||
const addCustomNode = (state: State, { payload }: AddCustomNodeAction): State => ({
|
||||
...state,
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { customNodes, State as CustomNodesState } from './customNodes';
|
||||
import { staticNodes, State as StaticNodesState } from './staticNodes';
|
||||
import { selectedNode, State as SelectedNodeState } from './selectedNode';
|
||||
import { combineReducers } from 'redux';
|
||||
import { customNodes } from './customNodes';
|
||||
import { staticNodes } from './staticNodes';
|
||||
import { selectedNode } from './selectedNode';
|
||||
import { CustomNodesState, StaticNodesState, SelectedNodeState } from './types';
|
||||
|
||||
interface State {
|
||||
customNodes: CustomNodesState;
|
||||
|
|
|
@ -6,9 +6,20 @@ import {
|
|||
RemoveCustomNodeAction,
|
||||
CustomNodeAction
|
||||
} from 'actions/config';
|
||||
import { SelectedNodeState as State } from './types';
|
||||
|
||||
export const INITIAL_STATE: State = {
|
||||
interface NodeLoaded {
|
||||
pending: false;
|
||||
nodeId: string;
|
||||
}
|
||||
|
||||
interface NodeChangePending {
|
||||
pending: true;
|
||||
nodeId: string;
|
||||
}
|
||||
|
||||
export type State = NodeLoaded | NodeChangePending;
|
||||
|
||||
export const INITIAL_STATE: NodeLoaded = {
|
||||
nodeId: 'eth_mycrypto',
|
||||
pending: false
|
||||
};
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import { EtherscanNode, InfuraNode, RPCNode } from 'libs/nodes';
|
||||
import { TypeKeys, NodeAction } from 'actions/config';
|
||||
import { StaticNodesState as State } from './types';
|
||||
import { NonWeb3NodeConfigs, Web3NodeConfigs } from 'types/node';
|
||||
|
||||
export type State = NonWeb3NodeConfigs & Web3NodeConfigs;
|
||||
|
||||
export const INITIAL_STATE: State = {
|
||||
eth_mycrypto: {
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
// Moving state types into their own file resolves an annoying webpack bug
|
||||
// https://github.com/angular/angular-cli/issues/2034
|
||||
import { NonWeb3NodeConfigs, Web3NodeConfigs, CustomNodeConfig } from 'types/node';
|
||||
|
||||
export interface CustomNodesState {
|
||||
[customNodeId: string]: CustomNodeConfig;
|
||||
}
|
||||
|
||||
interface NodeLoaded {
|
||||
pending: false;
|
||||
nodeId: string;
|
||||
}
|
||||
|
||||
interface NodeChangePending {
|
||||
pending: true;
|
||||
nodeId: string;
|
||||
}
|
||||
|
||||
export type SelectedNodeState = NodeLoaded | NodeChangePending;
|
||||
|
||||
export type StaticNodesState = NonWeb3NodeConfigs & Web3NodeConfigs;
|
|
@ -79,7 +79,7 @@ export function* shouldBroadcastTransaction(indexingHash: string): SagaIterator
|
|||
}
|
||||
return true;
|
||||
}
|
||||
export function* getSerializedTxAndIndexingHash({ type }: BroadcastRequestedAction): SagaIterator {
|
||||
export function* getSerializedTxAndIndexingHash({ type }: BroadcastRequestedAction) {
|
||||
const isWeb3Req = type === TK.BROADCAST_WEB3_TRANSACTION_REQUESTED;
|
||||
const txSelector = isWeb3Req ? getWeb3Tx : getSignedTx;
|
||||
const serializedTransaction: StateSerializedTx = yield select(txSelector);
|
||||
|
|
|
@ -39,9 +39,7 @@ const signTransactionWrapper = (func: (IWalletAndTx: IFullWalletAndTransaction)
|
|||
* the rest of the tx parameters from the action
|
||||
* @param partialTx
|
||||
*/
|
||||
function* getWalletAndTransaction(
|
||||
partialTx: SignTransactionRequestedAction['payload']
|
||||
): SagaIterator {
|
||||
function* getWalletAndTransaction(partialTx: SignTransactionRequestedAction['payload']) {
|
||||
// get the wallet we're going to sign with
|
||||
const wallet: null | IFullWallet = yield select(getWalletInst);
|
||||
if (!wallet) {
|
||||
|
|
64
package.json
64
package.json
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "MyCrypto",
|
||||
"author": "MyCryptoHQ",
|
||||
"version": "0.6.3",
|
||||
"version": "0.6.4",
|
||||
"main": "main.js",
|
||||
"description": "MyCrypto web and electron app",
|
||||
"repository": "https://github.com/MyCryptoHQ/MyCrypto",
|
||||
|
@ -22,6 +22,7 @@
|
|||
"ethereumjs-util": "5.1.5",
|
||||
"ethereumjs-wallet": "0.6.0",
|
||||
"font-awesome": "4.7.0",
|
||||
"hard-source-webpack-plugin": "0.5.16",
|
||||
"hdkey": "0.8.0",
|
||||
"idna-uts46": "1.1.0",
|
||||
"jsonschema": "1.2.2",
|
||||
|
@ -75,7 +76,11 @@
|
|||
"@types/uuid": "3.4.3",
|
||||
"@types/webpack-env": "1.13.4",
|
||||
"@types/zxcvbn": "4.4.0",
|
||||
"autodll-webpack-plugin": "0.3.9",
|
||||
"autodll-webpack-plugin": "0.3.8",
|
||||
"awesome-typescript-loader": "3.5.0",
|
||||
"babel-minify-webpack-plugin": "0.3.0",
|
||||
"bs58": "4.0.1",
|
||||
"cache-loader": "1.2.2",
|
||||
"check-node-version": "3.2.0",
|
||||
"concurrently": "3.5.1",
|
||||
"copy-webpack-plugin": "4.5.1",
|
||||
|
@ -87,44 +92,47 @@
|
|||
"enzyme-adapter-react-16": "1.1.1",
|
||||
"enzyme-to-json": "3.3.3",
|
||||
"express": "4.16.2",
|
||||
"extract-text-webpack-plugin": "3.0.2",
|
||||
"favicons-webpack-plugin": "0.0.8",
|
||||
"file-loader": "1.1.11",
|
||||
"friendly-errors-webpack-plugin": "1.6.1",
|
||||
"hard-source-webpack-plugin": "0.6.4",
|
||||
"html-webpack-plugin": "3.0.6",
|
||||
"glob": "7.1.2",
|
||||
"hoist-non-react-statics": "2.5.0",
|
||||
"html-webpack-plugin": "3.0.3",
|
||||
"husky": "0.14.3",
|
||||
"image-webpack-loader": "4.2.0",
|
||||
"jest": "22.1.4",
|
||||
"klaw-sync": "3.0.2",
|
||||
"lint-staged": "7.0.0",
|
||||
"mini-css-extract-plugin": "0.2.0",
|
||||
"minimist": "1.2.0",
|
||||
"node-sass": "4.8.3",
|
||||
"nodemon": "1.17.2",
|
||||
"null-loader": "0.1.1",
|
||||
"prettier": "1.11.1",
|
||||
"react-hot-loader": "4.0.0",
|
||||
"progress": "2.0.0",
|
||||
"react-hot-loader": "3.1.3",
|
||||
"react-test-renderer": "16.2.0",
|
||||
"redux-devtools-extension": "2.13.2",
|
||||
"redux-test-utils": "0.2.2",
|
||||
"resolve-url-loader": "2.3.0",
|
||||
"rimraf": "2.6.2",
|
||||
"sass-loader": "6.0.7",
|
||||
"style-loader": "0.20.3",
|
||||
"thread-loader": "1.1.5",
|
||||
"ts-jest": "22.4.2",
|
||||
"ts-loader": "4.1.0",
|
||||
"ts-loader": "3.3.1",
|
||||
"tslint": "5.9.1",
|
||||
"tslint-config-prettier": "1.10.0",
|
||||
"tslint-microsoft-contrib": "5.0.3",
|
||||
"tslint-react": "3.5.1",
|
||||
"types-rlp": "0.0.1",
|
||||
"typescript": "2.7.2",
|
||||
"uglifyjs-webpack-plugin": "1.2.4",
|
||||
"typescript": "2.6.2",
|
||||
"url-loader": "1.0.1",
|
||||
"url-search-params-polyfill": "3.0.0",
|
||||
"webpack": "4.2.0",
|
||||
"webpack-cli": "2.0.13",
|
||||
"webpack-dev-middleware": "3.1.0",
|
||||
"webpack-hot-middleware": "2.21.2",
|
||||
"webpack-sources": "1.1.0",
|
||||
"webpack": "3.11.0",
|
||||
"webpack-dev-middleware": "2.0.6",
|
||||
"webpack-hot-middleware": "2.21.0",
|
||||
"webpack-sources": "1.0.1",
|
||||
"webpack-subresource-integrity": "1.1.0-rc.4",
|
||||
"what-input": "5.0.5",
|
||||
"worker-loader": "1.1.1"
|
||||
|
@ -133,14 +141,18 @@
|
|||
"freezer": "webpack --config=./webpack_config/webpack.freezer.js && node ./dist/freezer.js",
|
||||
"freezer:validate": "npm run freezer -- --validate",
|
||||
"db": "nodemon ./db",
|
||||
"build": "webpack --mode=production --config webpack_config/webpack.prod.js",
|
||||
"build": "webpack --config webpack_config/webpack.prod.js",
|
||||
"prebuild": "check-node-version --package",
|
||||
"build:downloadable": "webpack --mode=production --config webpack_config/webpack.html.js",
|
||||
"build:downloadable": "webpack --config webpack_config/webpack.html.js",
|
||||
"prebuild:downloadable": "check-node-version --package",
|
||||
"build:electron": "webpack --config webpack_config/webpack.electron-prod.js && node webpack_config/buildElectron.js",
|
||||
"build:electron:osx": "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=osx node webpack_config/buildElectron.js",
|
||||
"build:electron:windows": "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=windows node webpack_config/buildElectron.js",
|
||||
"build:electron:linux": "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=linux node webpack_config/buildElectron.js",
|
||||
"build:electron":
|
||||
"webpack --config webpack_config/webpack.electron-prod.js && node webpack_config/buildElectron.js",
|
||||
"build:electron:osx":
|
||||
"webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=osx node webpack_config/buildElectron.js",
|
||||
"build:electron:windows":
|
||||
"webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=windows node webpack_config/buildElectron.js",
|
||||
"build:electron:linux":
|
||||
"webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=linux node webpack_config/buildElectron.js",
|
||||
"prebuild:electron": "check-node-version --package",
|
||||
"jenkins:build:linux": "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=JENKINS_LINUX node webpack_config/buildElectron.js",
|
||||
"jenkins:build:mac": "webpack --config webpack_config/webpack.electron-prod.js && ELECTRON_OS=JENKINS_MAC node webpack_config/buildElectron.js",
|
||||
|
@ -155,14 +167,18 @@
|
|||
"predev": "check-node-version --package",
|
||||
"dev:https": "HTTPS=true node webpack_config/devServer.js",
|
||||
"predev:https": "check-node-version --package",
|
||||
"dev:electron": "concurrently --kill-others --names 'webpack,electron' 'BUILD_ELECTRON=true node webpack_config/devServer.js' 'webpack --config webpack_config/webpack.electron-dev.js && electron dist/electron-js/main.js'",
|
||||
"dev:electron:https": "concurrently --kill-others --names 'webpack,electron' 'BUILD_ELECTRON=true HTTPS=true node webpack_config/devServer.js' 'HTTPS=true webpack --config webpack_config/webpack.electron-dev.js && electron dist/electron-js/main.js'",
|
||||
"dev:electron":
|
||||
"concurrently --kill-others --names 'webpack,electron' 'BUILD_ELECTRON=true node webpack_config/devServer.js' 'webpack --config webpack_config/webpack.electron-dev.js && electron dist/electron-js/main.js'",
|
||||
"dev:electron:https":
|
||||
"concurrently --kill-others --names 'webpack,electron' 'BUILD_ELECTRON=true HTTPS=true node webpack_config/devServer.js' 'HTTPS=true webpack --config webpack_config/webpack.electron-dev.js && electron dist/electron-js/main.js'",
|
||||
"tslint": "tslint --project . --exclude common/vendor/**/*",
|
||||
"tscheck": "tsc --noEmit",
|
||||
"start": "npm run dev",
|
||||
"precommit": "lint-staged",
|
||||
"formatAll": "find ./common/ -name '*.ts*' | xargs prettier --write --config ./.prettierrc --config-precedence file-override",
|
||||
"prettier:diff": "prettier --write --config ./.prettierrc --list-different \"common/**/*.ts\" \"common/**/*.tsx\"",
|
||||
"formatAll":
|
||||
"find ./common/ -name '*.ts*' | xargs prettier --write --config ./.prettierrc --config-precedence file-override",
|
||||
"prettier:diff":
|
||||
"prettier --write --config ./.prettierrc --list-different \"common/**/*.ts\" \"common/**/*.tsx\"",
|
||||
"prepush": "npm run tslint && npm run tscheck"
|
||||
},
|
||||
"lint-staged": {
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
import packageJSON from '../package.json';
|
||||
|
||||
interface Dependencies {
|
||||
[key: string]: string;
|
||||
}
|
||||
|
||||
// from https://docs.npmjs.com/files/package.json#dependencies
|
||||
const nonExactPrefixes = ['~', '^', '>', '>=', '<', '<='];
|
||||
|
||||
describe('package.json', () => {
|
||||
it('dependencies should not contain any non-exact versions', () => {
|
||||
const deps = Object.values(packageJSON.dependencies as Dependencies);
|
||||
const deps = Object.values(packageJSON.dependencies);
|
||||
deps.forEach(depVersion => {
|
||||
nonExactPrefixes.forEach(badPrefix => {
|
||||
expect(depVersion.includes(badPrefix)).toBeFalsy();
|
||||
|
@ -17,7 +13,7 @@ describe('package.json', () => {
|
|||
});
|
||||
});
|
||||
it('devDependencies should not contain any non-exact versions', () => {
|
||||
const deps = Object.values(packageJSON.devDependencies as Dependencies);
|
||||
const deps = Object.values(packageJSON.devDependencies);
|
||||
deps.forEach(depVersion => {
|
||||
nonExactPrefixes.forEach(badPrefix => {
|
||||
expect(depVersion.includes(badPrefix)).toBeFalsy();
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import { changeNodeIntent, changeNode } from 'actions/config';
|
||||
import { selectedNode } from 'reducers/config/nodes/selectedNode';
|
||||
import { SelectedNodeState } from 'reducers/config/nodes/types';
|
||||
import { State, selectedNode } from 'reducers/config/nodes/selectedNode';
|
||||
|
||||
export const expectedState = {
|
||||
initialState: { nodeId: 'eth_mycrypto', pending: false },
|
||||
|
@ -21,9 +20,9 @@ describe('selected node reducer', () => {
|
|||
expect(selectedNode(undefined, actions.changeNode)).toEqual(expectedState.nodeChange));
|
||||
|
||||
it('should handle the intent to change a node', () =>
|
||||
expect(
|
||||
selectedNode(expectedState.initialState as SelectedNodeState, actions.changeNodeIntent)
|
||||
).toEqual(expectedState.nodeChangeIntent));
|
||||
expect(selectedNode(expectedState.initialState as State, actions.changeNodeIntent)).toEqual(
|
||||
expectedState.nodeChangeIntent
|
||||
));
|
||||
});
|
||||
|
||||
export { actions as selectedNodeActions, expectedState as selectedNodeExpectedState };
|
||||
|
|
|
@ -45,7 +45,7 @@ const devMiddleWare = require('webpack-dev-middleware')(compiler, {
|
|||
app.use(devMiddleWare);
|
||||
app.use(
|
||||
require('webpack-hot-middleware')(compiler, {
|
||||
log: false
|
||||
log: console.info
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -6,12 +6,13 @@ const threadLoader = require('thread-loader');
|
|||
const HtmlWebpackPlugin = require('html-webpack-plugin');
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
|
||||
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
|
||||
// const AutoDllPlugin = require('autodll-webpack-plugin');
|
||||
const AutoDllPlugin = require('autodll-webpack-plugin');
|
||||
const HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
|
||||
const FaviconsWebpackPlugin = require('favicons-webpack-plugin');
|
||||
const ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
const ProgressPlugin = require('webpack/lib/ProgressPlugin');
|
||||
const BabelMinifyPlugin = require('babel-minify-webpack-plugin');
|
||||
const SriPlugin = require('webpack-subresource-integrity');
|
||||
const MiniCSSExtractPlugin = require('mini-css-extract-plugin');
|
||||
const ClearDistPlugin = require('./plugins/clearDist');
|
||||
const SortCachePlugin = require('./plugins/sortCache');
|
||||
|
||||
|
@ -70,18 +71,17 @@ module.exports = function(opts = {}) {
|
|||
rules.push(
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
MiniCSSExtractPlugin.loader,
|
||||
'css-loader'
|
||||
]
|
||||
use: ExtractTextPlugin.extract({
|
||||
fallback: 'style-loader',
|
||||
use: 'css-loader'
|
||||
})
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
MiniCSSExtractPlugin.loader,
|
||||
'css-loader',
|
||||
'sass-loader'
|
||||
]
|
||||
use: ExtractTextPlugin.extract({
|
||||
fallback: 'style-loader',
|
||||
use: ['css-loader', 'sass-loader']
|
||||
})
|
||||
}
|
||||
);
|
||||
} else {
|
||||
|
@ -186,9 +186,24 @@ module.exports = function(opts = {}) {
|
|||
|
||||
if (options.isProduction) {
|
||||
plugins.push(
|
||||
new MiniCSSExtractPlugin({
|
||||
filename: '[name].[chunkhash:8].css'
|
||||
new BabelMinifyPlugin(
|
||||
{
|
||||
// Mangle seems to be reusing variable identifiers, causing errors
|
||||
mangle: false,
|
||||
// These two on top of a lodash file are causing illegal characters for
|
||||
// safari and ios browsers
|
||||
evaluate: false,
|
||||
propertyLiterals: false
|
||||
},
|
||||
{
|
||||
comments: false
|
||||
}
|
||||
),
|
||||
new webpack.optimize.CommonsChunkPlugin({
|
||||
name: 'vendor',
|
||||
filename: 'vendor.[chunkhash:8].js'
|
||||
}),
|
||||
new ExtractTextPlugin('[name].[chunkhash:8].css'),
|
||||
new FaviconsWebpackPlugin({
|
||||
logo: path.resolve(config.path.assets, 'images/favicon.png'),
|
||||
background: '#163151',
|
||||
|
@ -204,23 +219,24 @@ module.exports = function(opts = {}) {
|
|||
);
|
||||
} else {
|
||||
plugins.push(
|
||||
// new AutoDllPlugin({
|
||||
// inject: true, // will inject the DLL bundles to index.html
|
||||
// filename: '[name]_[hash].js',
|
||||
// debug: true,
|
||||
// context: path.join(config.path.root),
|
||||
// entry: {
|
||||
// vendor: [...config.vendorModules, 'babel-polyfill', 'bootstrap-sass', 'font-awesome']
|
||||
// }
|
||||
// }),
|
||||
new AutoDllPlugin({
|
||||
inject: true, // will inject the DLL bundles to index.html
|
||||
filename: '[name]_[hash].js',
|
||||
debug: true,
|
||||
context: path.join(config.path.root),
|
||||
entry: {
|
||||
vendor: [...config.vendorModules, 'babel-polyfill', 'bootstrap-sass', 'font-awesome']
|
||||
}
|
||||
}),
|
||||
new HardSourceWebpackPlugin({
|
||||
environmentHash: {
|
||||
root: process.cwd(),
|
||||
directories: ['common/webpack_config'],
|
||||
directories: ['webpack_config'],
|
||||
files: ['package.json']
|
||||
}
|
||||
}),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.NoEmitOnErrorsPlugin(),
|
||||
new FriendlyErrorsPlugin()
|
||||
);
|
||||
}
|
||||
|
@ -245,17 +261,6 @@ module.exports = function(opts = {}) {
|
|||
);
|
||||
}
|
||||
|
||||
// ====================
|
||||
// === Optimization ===
|
||||
// ====================
|
||||
const optimization = {};
|
||||
if (options.isProduction) {
|
||||
optimization.splitChunks = {
|
||||
chunks: 'all'
|
||||
};
|
||||
optimization.concatenateModules = false;
|
||||
}
|
||||
|
||||
// ====================
|
||||
// ====== DevTool =====
|
||||
// ====================
|
||||
|
@ -290,8 +295,6 @@ module.exports = function(opts = {}) {
|
|||
performance: {
|
||||
hints: options.isProduction ? 'warning' : false
|
||||
},
|
||||
optimization,
|
||||
mode: options.isProduction ? 'production' : 'development',
|
||||
stats: {
|
||||
// Reduce build output
|
||||
children: false,
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
'use strict';
|
||||
const chalk = require('chalk');
|
||||
|
||||
const LogPlugin = function(port) {
|
||||
// this plugin if for loggin url after each time the compilation is done.
|
||||
module.exports = class LogPlugin {
|
||||
constructor(port) {
|
||||
this.port = port;
|
||||
this.protocol = process.env.HTTPS ? 'https' : 'http';
|
||||
};
|
||||
}
|
||||
|
||||
LogPlugin.prototype.apply = function(compiler) {
|
||||
compiler.plugin('done', (compiler, done) => {
|
||||
apply(compiler) {
|
||||
const protocol = process.env.HTTPS ? 'https' : 'http';
|
||||
compiler.plugin('done', () => {
|
||||
console.log(
|
||||
`> App is running at ${chalk.yellow(
|
||||
`${this.protocol}://localhost:${this.port}`
|
||||
`${protocol}://localhost:${this.port}`
|
||||
)}\n`
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = LogPlugin;
|
||||
|
|
|
@ -7,7 +7,6 @@ const makeConfig = require('./makeConfig');
|
|||
|
||||
const electronConfig = {
|
||||
target: 'electron-main',
|
||||
mode: 'development',
|
||||
entry: {
|
||||
main: path.join(config.path.electron, 'main/index.ts')
|
||||
},
|
||||
|
|
|
@ -13,8 +13,6 @@ const jsConfig = makeConfig({
|
|||
});
|
||||
|
||||
// Redefine plugins with prod specific stuff
|
||||
electronConfig.mode = 'production';
|
||||
|
||||
electronConfig.plugins = [
|
||||
new ClearDistPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
|
|
|
@ -5,7 +5,6 @@ const config = require('./config');
|
|||
|
||||
const freezerConfig = {
|
||||
target: 'node',
|
||||
mode: 'development',
|
||||
entry: './common/freezer',
|
||||
output: {
|
||||
path: config.path.output,
|
||||
|
|
Loading…
Reference in New Issue