mirror of https://github.com/trezor/trezor-wallet
parent
9efe52b568
commit
166e51525b
@ -0,0 +1,79 @@
|
|||||||
|
import { SRC, BUILD, PORT } from './constants';
|
||||||
|
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
||||||
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
watch: true,
|
||||||
|
mode: 'development',
|
||||||
|
devtool: 'inline-source-map',
|
||||||
|
entry: {
|
||||||
|
'index': [ 'react-hot-loader/patch', `${SRC}js/index.js` ]
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: '[name].[hash].js',
|
||||||
|
path: BUILD,
|
||||||
|
publicPath: '/',
|
||||||
|
},
|
||||||
|
devServer: {
|
||||||
|
contentBase: SRC,
|
||||||
|
hot: true,
|
||||||
|
https: false,
|
||||||
|
port: PORT,
|
||||||
|
stats: 'minimal',
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.jsx?$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
use: ['babel-loader']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.less$/,
|
||||||
|
use: [
|
||||||
|
MiniCssExtractPlugin.loader,
|
||||||
|
'css-loader',
|
||||||
|
'less-loader',
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(png|gif|jpg)$/,
|
||||||
|
loader: 'file-loader?name=./images/[name].[ext]'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(ttf|eot|svg|woff|woff2)$/,
|
||||||
|
loader: 'file-loader',
|
||||||
|
query: {
|
||||||
|
name: './fonts/[name].[hash].[ext]',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
modules: [SRC, 'node_modules'],
|
||||||
|
},
|
||||||
|
performance: {
|
||||||
|
hints: false
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: '[name].css',
|
||||||
|
chunkFilename: '[id].css',
|
||||||
|
}),
|
||||||
|
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
chunks: ['index'],
|
||||||
|
template: `${SRC}index.html`,
|
||||||
|
filename: 'index.html',
|
||||||
|
inject: true
|
||||||
|
}),
|
||||||
|
|
||||||
|
new webpack.optimize.OccurrenceOrderPlugin(),
|
||||||
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
|
new webpack.HotModuleReplacementPlugin(),
|
||||||
|
new webpack.NamedModulesPlugin(),
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
import { SRC, BUILD, PORT } from './constants';
|
||||||
|
|
||||||
|
import webpack from 'webpack';
|
||||||
|
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
||||||
|
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
||||||
|
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
mode: 'production',
|
||||||
|
entry: {
|
||||||
|
'index': [ `${SRC}js/index.js` ]
|
||||||
|
},
|
||||||
|
output: {
|
||||||
|
filename: 'js/[name].[hash].js',
|
||||||
|
path: BUILD,
|
||||||
|
publicPath: './',
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{
|
||||||
|
test: /\.jsx?$/,
|
||||||
|
exclude: /node_modules/,
|
||||||
|
use: ['babel-loader']
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.less$/,
|
||||||
|
use: [
|
||||||
|
MiniCssExtractPlugin.loader,
|
||||||
|
{
|
||||||
|
loader: 'css-loader',
|
||||||
|
// options: { minimize: true }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
loader: 'less-loader',
|
||||||
|
// options: { minimize: true }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(png|gif|jpg)$/,
|
||||||
|
exclude: /(node_modules)/,
|
||||||
|
loader: 'file-loader',
|
||||||
|
query: {
|
||||||
|
publicPath: '../',
|
||||||
|
name: 'images/[name].[hash].[ext]'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
test: /\.(ttf|eot|svg|woff|woff2)$/,
|
||||||
|
loader: 'file-loader',
|
||||||
|
query: {
|
||||||
|
publicPath: '../',
|
||||||
|
name: 'fonts/[name].[hash].[ext]',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
modules: [SRC, 'node_modules'],
|
||||||
|
},
|
||||||
|
performance: {
|
||||||
|
hints: false
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: 'css/[name].[hash].css',
|
||||||
|
}),
|
||||||
|
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
chunks: ['index'],
|
||||||
|
template: `${SRC}index.html`,
|
||||||
|
filename: 'index.html',
|
||||||
|
inject: true
|
||||||
|
}),
|
||||||
|
|
||||||
|
new CopyWebpackPlugin([
|
||||||
|
//{from: `${SRC}/app/robots.txt`},
|
||||||
|
{ from: `${SRC}images/favicon.ico`, to: `${BUILD}favicon.ico` },
|
||||||
|
{ from: `${SRC}images/favicon.png`, to: `${BUILD}favicon.png` },
|
||||||
|
{ from: `${SRC}data`, to: `${BUILD}data`, cache: false },
|
||||||
|
{ from: `${SRC}assets`, to: `${BUILD}assets`, cache: false },
|
||||||
|
]),
|
||||||
|
|
||||||
|
new webpack.optimize.OccurrenceOrderPlugin(),
|
||||||
|
new webpack.NoEmitOnErrorsPlugin(),
|
||||||
|
new webpack.NamedModulesPlugin(),
|
||||||
|
]
|
||||||
|
}
|
@ -1,35 +0,0 @@
|
|||||||
import express from 'express';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import open from 'open';
|
|
||||||
import { argv } from 'yargs';
|
|
||||||
import { SRC, PORT, INDEX, ABSOLUTE_BASE, TREZOR_CONNECT } from './constants';
|
|
||||||
//import config from './webpack.config.library';
|
|
||||||
|
|
||||||
const config = argv.connect ? require('./webpack.config.connect') : require('./webpack.config.dev');
|
|
||||||
|
|
||||||
const app = express();
|
|
||||||
const compiler = webpack(config);
|
|
||||||
|
|
||||||
app.use(require('webpack-dev-middleware')(compiler, {
|
|
||||||
contentBase: '/',
|
|
||||||
hot: true,
|
|
||||||
inline: true,
|
|
||||||
compress: true,
|
|
||||||
noInfo: false,
|
|
||||||
stats: { colors: true }
|
|
||||||
}));
|
|
||||||
app.use(require('webpack-hot-middleware')(compiler));
|
|
||||||
|
|
||||||
app.get('*', function(req, res) {
|
|
||||||
res.sendFile(SRC + req.params[0]);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.listen(PORT, 'localhost', function(err) {
|
|
||||||
if (err) {
|
|
||||||
console.log(err);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
open(`http://localhost:${PORT}/`);
|
|
||||||
console.log(`Listening at http://localhost:${PORT}`);
|
|
||||||
console.log(`Serving ${INDEX}`);
|
|
||||||
});
|
|
@ -1,130 +0,0 @@
|
|||||||
import { SRC, BUILD, TREZOR_CONNECT, TREZOR_CONNECT_FILES, TREZOR_CONNECT_HTML } from './constants';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
||||||
import ExtractTextPlugin from 'extract-text-webpack-plugin';
|
|
||||||
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
|
||||||
|
|
||||||
const extractLess = new ExtractTextPlugin({
|
|
||||||
filename: 'css/[name].[contenthash].css',
|
|
||||||
//disable: process.env.NODE_ENV === 'development'
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: {
|
|
||||||
index: ['whatwg-fetch', `${SRC}js/index.js`]
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: 'js/[name].[hash].js',
|
|
||||||
path: BUILD
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.jsx?$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: ['babel-loader']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.less$/,
|
|
||||||
include: `${SRC}styles`,
|
|
||||||
loader: extractLess.extract({
|
|
||||||
use: [
|
|
||||||
{ loader: 'css-loader' },
|
|
||||||
{ loader: 'less-loader' }
|
|
||||||
],
|
|
||||||
fallback: 'style-loader'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.css$/,
|
|
||||||
loader: extractLess.extract({
|
|
||||||
use: [
|
|
||||||
{ loader: 'css-loader' }
|
|
||||||
],
|
|
||||||
fallback: 'style-loader'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(png|gif|jpg)$/,
|
|
||||||
loader: 'file-loader',
|
|
||||||
query: {
|
|
||||||
publicPath: '../',
|
|
||||||
name: 'images/[name].[hash].[ext]',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(ttf|eot|svg|woff|woff2)$/,
|
|
||||||
// loader: 'file-loader?publicPath=../&name=fonts/[name].[hash].[ext]',
|
|
||||||
loader: 'file-loader',
|
|
||||||
query: {
|
|
||||||
publicPath: '../',
|
|
||||||
name: 'fonts/[name].[hash].[ext]',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(wasm)$/,
|
|
||||||
loader: 'file-loader',
|
|
||||||
query: {
|
|
||||||
name: 'js/[name].[hash].[ext]',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.json$/,
|
|
||||||
loader: 'json-loader'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
modules: [SRC, 'node_modules'],
|
|
||||||
alias: {
|
|
||||||
'trezor-connect': `${TREZOR_CONNECT}`,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
performance: {
|
|
||||||
hints: false
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
|
|
||||||
extractLess,
|
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: `${SRC}index.html`,
|
|
||||||
inject: 'body',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new CopyWebpackPlugin([
|
|
||||||
//{from: `${SRC}/app/robots.txt`},
|
|
||||||
//{ from: `${SRC}js/vendor`, to: `${BUILD}js/vendor` },
|
|
||||||
//{ from: `${SRC}config.json` },
|
|
||||||
//{ from: `${SRC}images/favicon.png`, to: `${BUILD}favicon.png` },
|
|
||||||
{ from: `${SRC}images/favicon.ico`, to: `${BUILD}favicon.ico` },
|
|
||||||
{ from: `${SRC}images/favicon.png`, to: `${BUILD}favicon.png` },
|
|
||||||
{ from: `${SRC}images/dashboard.png`, to: `${BUILD}images/dashboard.png` },
|
|
||||||
{ from: `${SRC}data`, to: `${BUILD}data`, cache: false },
|
|
||||||
]),
|
|
||||||
new webpack.optimize.OccurrenceOrderPlugin(),
|
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
|
||||||
// new webpack.optimize.UglifyJsPlugin({
|
|
||||||
// compress: {
|
|
||||||
// warnings: false,
|
|
||||||
// }
|
|
||||||
// }),
|
|
||||||
new CopyWebpackPlugin([
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}config.json`, to: `${BUILD}/data/config.json` },
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}coins.json`, to: `${BUILD}/data/coins.json` },
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}releases-1.json`, to: `${BUILD}/data/releases-1.json` },
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}releases-2.json`, to: `${BUILD}/data/releases-2.json` },
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}latest.txt`, to: `${BUILD}/data/latest.txt` },
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}config_signed.bin`, to: `${BUILD}/data/config_signed.bin` },
|
|
||||||
]),
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
||||||
PRODUCTION: JSON.stringify(false)
|
|
||||||
}),
|
|
||||||
new webpack.IgnorePlugin(/node-fetch/), // for trezor-link warning
|
|
||||||
],
|
|
||||||
// ignoring "fs" import in fastxpub
|
|
||||||
node: {
|
|
||||||
fs: "empty"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
import { TREZOR_CONNECT, TREZOR_IFRAME, TREZOR_POPUP, TREZOR_CONNECT_FILES, TREZOR_CONNECT_HTML } from './constants';
|
|
||||||
import path from 'path';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import webpackMerge from 'webpack-merge';
|
|
||||||
import baseConfig from './webpack.config.dev';
|
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
||||||
|
|
||||||
module.exports = webpackMerge(baseConfig, {
|
|
||||||
entry: {
|
|
||||||
'trezor-connect2': `${TREZOR_CONNECT}.js`,
|
|
||||||
'iframe': ['babel-polyfill', `${TREZOR_IFRAME}`],
|
|
||||||
'popup': `${TREZOR_POPUP}`,
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
'trezor-connect': `${TREZOR_CONNECT}`,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
chunks: ['iframe'],
|
|
||||||
filename: `iframe.html`,
|
|
||||||
template: `${TREZOR_CONNECT_HTML}iframe.html`,
|
|
||||||
inject: true
|
|
||||||
}),
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
chunks: ['popup'],
|
|
||||||
filename: 'popup.html',
|
|
||||||
template: `${TREZOR_CONNECT_HTML}popup.html`,
|
|
||||||
inject: true
|
|
||||||
}),
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env.NODE_ENV': JSON.stringify('development-connect'),
|
|
||||||
PRODUCTION: JSON.stringify(false)
|
|
||||||
})
|
|
||||||
]
|
|
||||||
} );
|
|
@ -1,112 +0,0 @@
|
|||||||
import { TREZOR_CONNECT_FILES, TREZOR_CONNECT_HTML, SRC, PORT } from './constants';
|
|
||||||
import path from 'path';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
||||||
import ExtractTextPlugin from 'extract-text-webpack-plugin';
|
|
||||||
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
|
||||||
|
|
||||||
const extractLess = new ExtractTextPlugin({
|
|
||||||
filename: './[name].[contenthash].css',
|
|
||||||
// disable: process.env.NODE_ENV === 'development'
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
devtool: 'inline-source-map',
|
|
||||||
entry: {
|
|
||||||
//'index': [ `${SRC}js/index.js`, `webpack-hot-middleware/client?path=/__webpack_hmr&timeout=20000&reload=true&__webpack_public_path=http://webpack:${PORT}`]
|
|
||||||
'index': [ `${SRC}js/index.js`, `webpack-hot-middleware/client?path=/__webpack_hmr`]
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: '[name].[hash].js',
|
|
||||||
path: '/',
|
|
||||||
publicPath: '/',
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.jsx?$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: ['babel-loader']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.less$/,
|
|
||||||
loader: extractLess.extract({
|
|
||||||
use: [
|
|
||||||
{ loader: 'css-loader' },
|
|
||||||
{ loader: 'less-loader' }
|
|
||||||
],
|
|
||||||
fallback: 'style-loader'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.css$/,
|
|
||||||
loader: extractLess.extract({
|
|
||||||
use: [
|
|
||||||
{ loader: 'css-loader' }
|
|
||||||
],
|
|
||||||
fallback: 'style-loader'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(png|gif|jpg)$/,
|
|
||||||
loader: 'file-loader?name=./images/[name].[ext]'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(wasm)$/,
|
|
||||||
loader: 'file-loader',
|
|
||||||
query: {
|
|
||||||
name: 'js/[name].[ext]',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.json($|\?)/,
|
|
||||||
loader: 'json-loader'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(ttf|eot|svg|woff|woff2)$/,
|
|
||||||
loader: 'file-loader',
|
|
||||||
query: {
|
|
||||||
name: './fonts/[name].[hash].[ext]',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
]
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
modules: [SRC, 'node_modules'],
|
|
||||||
},
|
|
||||||
performance: {
|
|
||||||
hints: false
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
extractLess,
|
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
chunks: ['index'],
|
|
||||||
template: `${SRC}index.html`,
|
|
||||||
filename: 'index.html',
|
|
||||||
inject: true
|
|
||||||
}),
|
|
||||||
new CopyWebpackPlugin([
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}config.json`, to: './data/config.json' },
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}coins.json`, to: './data/coins.json' },
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}releases-1.json`, to: './data/releases-1.json' },
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}latest.txt`, to: './data/latest.txt' },
|
|
||||||
{ from: `${TREZOR_CONNECT_FILES}config_signed.bin`, to: './data/config_signed.bin' },
|
|
||||||
// { from: `${SRC}images/favicon.png` },
|
|
||||||
// { from: `${SRC}images` },
|
|
||||||
]),
|
|
||||||
new webpack.optimize.OccurrenceOrderPlugin(),
|
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
|
||||||
new webpack.HotModuleReplacementPlugin(),
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env.NODE_ENV': JSON.stringify('development'),
|
|
||||||
PRODUCTION: JSON.stringify(false)
|
|
||||||
}),
|
|
||||||
new webpack.IgnorePlugin(/node-fetch/), // for trezor-link warning
|
|
||||||
],
|
|
||||||
// ignoring "fs" import in fastxpub
|
|
||||||
node: {
|
|
||||||
fs: "empty"
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
import { TREZOR_LIBRARY } from './constants';
|
|
||||||
import path from 'path';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import webpackMerge from 'webpack-merge';
|
|
||||||
import baseConfig from './webpack.config.dev';
|
|
||||||
|
|
||||||
module.exports = webpackMerge(baseConfig, {
|
|
||||||
entry: {
|
|
||||||
'trezor-library': `${TREZOR_LIBRARY}.js`
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
'trezor-connect': `${TREZOR_LIBRARY}`,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env.NODE_ENV': JSON.stringify('development-library'),
|
|
||||||
PRODUCTION: JSON.stringify(false)
|
|
||||||
})
|
|
||||||
]
|
|
||||||
} );
|
|
@ -1,127 +0,0 @@
|
|||||||
import { SRC, BUILD } from './constants';
|
|
||||||
import webpack from 'webpack';
|
|
||||||
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
||||||
import ExtractTextPlugin from 'extract-text-webpack-plugin';
|
|
||||||
import CopyWebpackPlugin from 'copy-webpack-plugin';
|
|
||||||
|
|
||||||
const extractLess = new ExtractTextPlugin({
|
|
||||||
filename: 'css/[name].[contenthash].css',
|
|
||||||
// disable: process.env.NODE_ENV === 'development'
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
entry: {
|
|
||||||
index: ['whatwg-fetch', `${SRC}js/index.js`]
|
|
||||||
},
|
|
||||||
output: {
|
|
||||||
filename: 'js/[name].[hash].js',
|
|
||||||
path: BUILD
|
|
||||||
},
|
|
||||||
module: {
|
|
||||||
rules: [
|
|
||||||
{
|
|
||||||
test: /\.jsx?$/,
|
|
||||||
exclude: /node_modules/,
|
|
||||||
use: ['babel-loader']
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.less$/,
|
|
||||||
include: `${SRC}styles`,
|
|
||||||
loader: extractLess.extract({
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: { minimize: true }
|
|
||||||
},
|
|
||||||
{
|
|
||||||
loader: 'less-loader',
|
|
||||||
options: { minimize: true }
|
|
||||||
}
|
|
||||||
],
|
|
||||||
fallback: 'style-loader'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.css$/,
|
|
||||||
loader: extractLess.extract({
|
|
||||||
use: [
|
|
||||||
{
|
|
||||||
loader: 'css-loader',
|
|
||||||
options: { minimize: true }
|
|
||||||
}
|
|
||||||
],
|
|
||||||
fallback: 'style-loader'
|
|
||||||
})
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(png|gif|jpg)$/,
|
|
||||||
loader: 'file-loader',
|
|
||||||
query: {
|
|
||||||
publicPath: '../',
|
|
||||||
name: 'images/[name].[hash].[ext]',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(ttf|eot|svg|woff|woff2)$/,
|
|
||||||
// loader: 'file-loader?publicPath=../&name=fonts/[name].[hash].[ext]',
|
|
||||||
loader: 'file-loader',
|
|
||||||
query: {
|
|
||||||
publicPath: '../',
|
|
||||||
name: 'fonts/[name].[hash].[ext]',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.(wasm)$/,
|
|
||||||
loader: 'file-loader',
|
|
||||||
query: {
|
|
||||||
name: 'js/[name].[hash].[ext]',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
test: /\.json$/,
|
|
||||||
loader: 'json-loader'
|
|
||||||
},
|
|
||||||
]
|
|
||||||
},
|
|
||||||
resolve: {
|
|
||||||
modules: [SRC, 'node_modules']
|
|
||||||
},
|
|
||||||
performance: {
|
|
||||||
hints: false
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
|
|
||||||
extractLess,
|
|
||||||
|
|
||||||
new HtmlWebpackPlugin({
|
|
||||||
template: `${SRC}index.html`,
|
|
||||||
inject: 'body',
|
|
||||||
}),
|
|
||||||
|
|
||||||
new CopyWebpackPlugin([
|
|
||||||
//{from: `${SRC}/app/robots.txt`},
|
|
||||||
//{ from: `${SRC}js/vendor`, to: `${BUILD}js/vendor` },
|
|
||||||
//{ from: `${SRC}config.json` },
|
|
||||||
{ from: `${SRC}images/favicon.ico`, to: `${BUILD}favicon.ico` },
|
|
||||||
{ from: `${SRC}images/favicon.png`, to: `${BUILD}favicon.png` },
|
|
||||||
{ from: `${SRC}images/dashboard.png`, to: `${BUILD}images/dashboard.png` },
|
|
||||||
{ from: `${SRC}data`, to: `${BUILD}data`, cache: false },
|
|
||||||
]),
|
|
||||||
new webpack.optimize.OccurrenceOrderPlugin(),
|
|
||||||
new webpack.NoEmitOnErrorsPlugin(),
|
|
||||||
new webpack.optimize.UglifyJsPlugin({
|
|
||||||
compress: {
|
|
||||||
warnings: false,
|
|
||||||
}
|
|
||||||
}),
|
|
||||||
new webpack.DefinePlugin({
|
|
||||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
|
||||||
PRODUCTION: JSON.stringify(false)
|
|
||||||
}),
|
|
||||||
new webpack.IgnorePlugin(/node-fetch/), // for trezor-link warning
|
|
||||||
],
|
|
||||||
// ignoring "fs" import in fastxpub
|
|
||||||
node: {
|
|
||||||
fs: "empty"
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue