mirror of
https://github.com/trezor/trezor-wallet
synced 2024-11-24 01:08:27 +00:00
webpack config build with trezor-connect alias (old backup)
This commit is contained in:
parent
89aee7eebd
commit
62a15b97ee
@ -5,7 +5,7 @@ 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.library');
|
||||
const config = argv.connect ? require('./webpack.config.connect') : require('./webpack.config.dev');
|
||||
|
||||
const app = express();
|
||||
const compiler = webpack(config);
|
||||
|
130
webpack/webpack.config.connect.babel.js
Normal file
130
webpack/webpack.config.connect.babel.js
Normal file
@ -0,0 +1,130 @@
|
||||
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"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user