mirror of
https://github.com/tlsnotary/tlsn-plugin-demo.git
synced 2026-01-06 20:14:01 -05:00
* Add interactive verifier demo * Serve and load plugin from local file * Show screenname at the end + removed attestation code * No more need for tlsn-js * Updated Docker container * Use environment variable to enable/disable POAPs * Improved UI * use LRU for tracking sessions Co-authored-by: Hendrik Eeckhaut <hendrik@eeckhaut.org>
188 lines
4.4 KiB
JavaScript
Executable File
188 lines
4.4 KiB
JavaScript
Executable File
var webpack = require('webpack'),
|
|
path = require('path'),
|
|
CopyWebpackPlugin = require('copy-webpack-plugin'),
|
|
HtmlWebpackPlugin = require('html-webpack-plugin'),
|
|
TerserPlugin = require('terser-webpack-plugin');
|
|
var { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
var ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
|
|
|
|
const ASSET_PATH = process.env.ASSET_PATH || '/';
|
|
|
|
var alias = {};
|
|
|
|
var fileExtensions = [
|
|
'jpg',
|
|
'jpeg',
|
|
'png',
|
|
'gif',
|
|
'eot',
|
|
'otf',
|
|
'svg',
|
|
'ttf',
|
|
'woff',
|
|
'woff2',
|
|
];
|
|
|
|
const isDevelopment = process.env.NODE_ENV !== 'production';
|
|
|
|
var options = {
|
|
mode: process.env.NODE_ENV || 'development',
|
|
ignoreWarnings: [
|
|
/Circular dependency between chunks with runtime/,
|
|
/ResizeObserver loop completed with undelivered notifications/,
|
|
],
|
|
entry: {
|
|
index: path.join(__dirname, 'web', 'index.tsx'),
|
|
},
|
|
output: {
|
|
filename: '[name].bundle.js',
|
|
path: path.resolve(__dirname, 'build', 'ui'),
|
|
clean: true,
|
|
publicPath: ASSET_PATH,
|
|
},
|
|
module: {
|
|
rules: [
|
|
{
|
|
// look for .css or .scss files
|
|
test: /\.(css|scss)$/,
|
|
|
|
// in the `src` directory
|
|
use: [
|
|
{
|
|
loader: 'style-loader',
|
|
},
|
|
{
|
|
loader: 'css-loader',
|
|
options: { importLoaders: 1 },
|
|
},
|
|
{
|
|
loader: 'postcss-loader',
|
|
},
|
|
{
|
|
loader: 'sass-loader',
|
|
options: {
|
|
sourceMap: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
// {
|
|
// test: new RegExp('.(' + fileExtensions.join('|') + ')$'),
|
|
// type: 'asset/resource',
|
|
// exclude: /node_modules/,
|
|
// },
|
|
{
|
|
test: /\.html$/,
|
|
loader: 'html-loader',
|
|
exclude: /node_modules/,
|
|
},
|
|
{
|
|
test: /\.(ts|tsx)$/,
|
|
use: [
|
|
{
|
|
loader: require.resolve("ts-loader"),
|
|
options: {
|
|
transpileOnly: isDevelopment,
|
|
allowTsInNodeModules: true,
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.(js|jsx)$/,
|
|
use: [
|
|
{
|
|
loader: 'source-map-loader',
|
|
},
|
|
{
|
|
loader: require.resolve('babel-loader'),
|
|
options: {
|
|
plugins: [
|
|
isDevelopment && require.resolve('react-refresh/babel'),
|
|
].filter(Boolean),
|
|
},
|
|
},
|
|
],
|
|
exclude: /node_modules/,
|
|
},
|
|
{
|
|
test: /\.(gif|png|jpe?g|svg)$/i,
|
|
use: [
|
|
'file-loader',
|
|
{
|
|
loader: 'image-webpack-loader',
|
|
options: {
|
|
publicPath: 'assets',
|
|
bypassOnDebug: true, // webpack@1.x
|
|
disable: true, // webpack@2.x and newer
|
|
},
|
|
},
|
|
],
|
|
},
|
|
{
|
|
test: /\.wasm$/,
|
|
type: 'webassembly/async',
|
|
},
|
|
],
|
|
},
|
|
resolve: {
|
|
alias: alias,
|
|
extensions: fileExtensions
|
|
.map((extension) => '.' + extension)
|
|
.concat(['.js', '.jsx', '.ts', '.tsx', '.css']),
|
|
},
|
|
plugins: [
|
|
isDevelopment && new ReactRefreshWebpackPlugin(),
|
|
new CleanWebpackPlugin({ verbose: false }),
|
|
new webpack.ProgressPlugin(),
|
|
// expose and write the allowed env vars on the compiled bundle
|
|
new webpack.EnvironmentPlugin({ NODE_ENV: 'development', POAP: 'false' }),
|
|
// new HtmlWebpackPlugin({
|
|
// template: path.join(__dirname, 'static', 'index.html'),
|
|
// filename: 'index.html',
|
|
// chunks: ['index'],
|
|
// cache: false,
|
|
// }),
|
|
new CopyWebpackPlugin({
|
|
patterns: [
|
|
{
|
|
from: "static/favicon.png",
|
|
to: path.join(__dirname, "build", "ui"),
|
|
force: true,
|
|
},
|
|
{
|
|
from: "static/logo.svg",
|
|
to: path.join(__dirname, "build", "ui"),
|
|
force: true,
|
|
},
|
|
{
|
|
from: "static/twitter_profile.tlsn.wasm",
|
|
to: path.join(__dirname, "build", "ui"),
|
|
force: true,
|
|
},
|
|
],
|
|
}),
|
|
new webpack.ProvidePlugin({
|
|
Buffer: ['buffer', 'Buffer'],
|
|
}),
|
|
].filter(Boolean),
|
|
infrastructureLogging: {
|
|
level: 'info',
|
|
}
|
|
};
|
|
|
|
if (process.env.NODE_ENV === 'development') {
|
|
options.devtool = 'cheap-module-source-map';
|
|
} else {
|
|
options.optimization = {
|
|
minimize: true,
|
|
minimizer: [
|
|
new TerserPlugin({
|
|
extractComments: false,
|
|
}),
|
|
],
|
|
};
|
|
}
|
|
|
|
module.exports = options;
|